diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-19 03:21:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-19 03:21:24 +0400 |
commit | 4dd7d4110a06422b5a86a609b7cc7687bd570fef (patch) | |
tree | 983554da24330943407ac010b4b66ed7da13b66a /source/blender/python/generic/py_capi_utils.c | |
parent | 7335a4af048d955105873500b5e4a402cd8ee00c (diff) |
replace macro PYC_INTERPRETER_ACTIVE for PyC_IsInterpreterActive() function call,
(indirectly referenced Python define of ~30 lines, most were optimized out but still caused some code bloat).
Diffstat (limited to 'source/blender/python/generic/py_capi_utils.c')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 11 |
1 files changed, 8 insertions, 3 deletions
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 */ |