diff options
Diffstat (limited to 'python/modules/IcePy/Util.h')
-rw-r--r-- | python/modules/IcePy/Util.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/python/modules/IcePy/Util.h b/python/modules/IcePy/Util.h index 54f1df6b21f..76035279ebe 100644 --- a/python/modules/IcePy/Util.h +++ b/python/modules/IcePy/Util.h @@ -28,6 +28,12 @@ namespace IcePy { +inline PyObject* incRef(PyObject* obj) +{ + Py_XINCREF(obj); + return obj; +} + // // This should be used instead of Py_False to avoid GCC compiler warnings. // @@ -58,16 +64,12 @@ inline PyObject* getTrue() inline PyObject* incFalse() { - PyObject* f = getFalse(); - Py_INCREF(f); - return f; + return incRef(getFalse()); } inline PyObject* incTrue() { - PyObject* t = getTrue(); - Py_INCREF(t); - return t; + return incRef(getTrue()); } // @@ -262,6 +264,12 @@ PyObject* createEncodingVersion(const Ice::EncodingVersion&); // bool getEncodingVersion(PyObject*, Ice::EncodingVersion&); +// +// Call a Python method. +// +PyObject* callMethod(PyObject*, const std::string&, PyObject* = 0, PyObject* = 0); +PyObject* callMethod(PyObject*, PyObject* = 0, PyObject* = 0); + } extern "C" PyObject* IcePy_stringVersion(PyObject*); |