Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r--source/blender/python/generic/idprop_py_api.c2
-rw-r--r--source/blender/python/generic/py_capi_utils.c11
-rw-r--r--source/blender/python/generic/py_capi_utils.h2
3 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index fc4b78b5c05..f7ed5fec891 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -1518,7 +1518,7 @@ void IDP_spit(IDProperty *prop)
{
if (prop) {
PyGILState_STATE gilstate;
- int use_gil = TRUE; /* !PYC_INTERPRETER_ACTIVE; */
+ int use_gil = TRUE; /* !PyC_IsInterpreterActive(); */
PyObject *ret_dict;
PyObject *ret_str;
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 2876d7666f4..63f66afd8a8 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -191,7 +191,7 @@ void PyC_LineSpit(void)
int lineno;
/* Note, allow calling from outside python (RNA) */
- if (!PYC_INTERPRETER_ACTIVE) {
+ if (!PyC_IsInterpreterActive()) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
}
@@ -205,7 +205,7 @@ void PyC_LineSpit(void)
void PyC_StackSpit(void)
{
/* Note, allow calling from outside python (RNA) */
- if (!PYC_INTERPRETER_ACTIVE) {
+ if (!PyC_IsInterpreterActive()) {
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
return;
}
@@ -258,7 +258,7 @@ void PyC_FileAndNum(const char **filename, int *lineno)
void PyC_FileAndNum_Safe(const char **filename, int *lineno)
{
- if (!PYC_INTERPRETER_ACTIVE) {
+ if (!PyC_IsInterpreterActive()) {
return;
}
@@ -599,6 +599,11 @@ void PyC_SetHomePath(const char *py_path_bundle)
}
}
+bool PyC_IsInterpreterActive(void)
+{
+ return (((PyThreadState *)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL);
+}
+
/* Would be nice if python had this built in
* See: http://wiki.blender.org/index.php/Dev:Doc/Tools/Debugging/PyFromC
*/
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 239858032de..8928642bc3e 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -56,7 +56,7 @@ void PyC_MainModule_Restore(PyObject *main_mod);
void PyC_SetHomePath(const char *py_path_bundle);
-#define PYC_INTERPRETER_ACTIVE (((PyThreadState *)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
+bool PyC_IsInterpreterActive(void);
void *PyC_RNA_AsPointer(PyObject *value, const char *type_name);