diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 08:42:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-06 11:09:11 +0300 |
commit | 9fd569a654ded46901c7f20c5fe080972cbb10d2 (patch) | |
tree | 933b893aeaa0a8bffe230933523512340dfa016d /source/blender/python/intern/bpy_app_translations.c | |
parent | ee58d449455df9470c4a0a902056b8c2001128bf (diff) |
PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
Diffstat (limited to 'source/blender/python/intern/bpy_app_translations.c')
-rw-r--r-- | source/blender/python/intern/bpy_app_translations.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 2135abdd589..1a56c0f7c59 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -45,6 +45,7 @@ #include "RNA_types.h" +#include "../generic/python_utildefines.h" typedef struct { @@ -406,7 +407,7 @@ static PyObject *app_translations_contexts_make(void) } #define SetObjString(item) PyStructSequence_SET_ITEM(translations_contexts, pos++, PyUnicode_FromString((item))) -#define SetObjNone() Py_INCREF(Py_None); PyStructSequence_SET_ITEM(translations_contexts, pos++, Py_None) +#define SetObjNone() PyStructSequence_SET_ITEM(translations_contexts, pos++, Py_INCREF_RET(Py_None)) for (ctxt = _contexts; ctxt->c_id; ctxt++) { if (ctxt->value) { @@ -516,9 +517,7 @@ static PyObject *_py_pgettext(PyObject *args, PyObject *kw, const char *(*_pgett return NULL; } - Py_INCREF(msgid); - - return msgid; + return Py_INCREF_RET(msgid); #endif } |