diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-05 15:27:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-05 15:41:25 +0300 |
commit | d3b3df037197d46b608eb38a5dbd6f1d2761ec36 (patch) | |
tree | 2fe30727f100f5f89415a25971c228ad44fc0994 /source/blender/python/generic/idprop_py_api.c | |
parent | d83681807e1ef39228620d10fee22003d753a050 (diff) |
IDProp API: add native C repr function
Was using Python which wasn't very efficient (even for logging).
Diffstat (limited to 'source/blender/python/generic/idprop_py_api.c')
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index c35472026fa..4b56d4412e6 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1806,49 +1806,3 @@ PyObject *BPyInit_idprop(void) return mod; } - -/* -------------------------------------------------------------------- */ -/* debug only function */ - -char *IDP_reprN(const IDProperty *prop) -{ - if (prop == NULL) { - return BLI_strdup("None"); - } - - PyGILState_STATE gilstate; - bool use_gil = true; /* !PyC_IsInterpreterActive(); */ - PyObject *ret_dict; - PyObject *ret_str; - - if (use_gil) { - gilstate = PyGILState_Ensure(); - } - - /* Note: non-const cast is safe here since we only repr the result. */ - /* to_dict() */ - ret_dict = BPy_IDGroup_MapDataToPy((IDProperty *)prop); - ret_str = PyObject_Repr(ret_dict); - Py_DECREF(ret_dict); - - Py_ssize_t res_str_len = 0; - char *res_str_bytes = _PyUnicode_AsStringAndSize(ret_str, &res_str_len); - - res_str_bytes = BLI_strdupn(res_str_bytes, res_str_len); - - Py_DECREF(ret_str); - - if (use_gil) { - PyGILState_Release(gilstate); - } - return res_str_bytes; -} - - -void IDP_print(const IDProperty *prop) -{ - char *repr = IDP_reprN(prop); - printf("IDProperty(%p): %s\n", prop, repr); - MEM_freeN(repr); -} - |