summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/pyrpc.h
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/rpc/pyrpc.h')
-rw-r--r--source4/librpc/rpc/pyrpc.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/source4/librpc/rpc/pyrpc.h b/source4/librpc/rpc/pyrpc.h
index c3bc83877c..52f4f4d3d3 100644
--- a/source4/librpc/rpc/pyrpc.h
+++ b/source4/librpc/rpc/pyrpc.h
@@ -22,6 +22,10 @@
#include "libcli/util/pyerrors.h"
+#ifndef Py_TYPE /* Py_TYPE is only available on Python > 2.6 */
+#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+#endif
+
#define PY_CHECK_TYPE(type, var, fail) \
if (!PyObject_TypeCheck(var, type)) {\
PyErr_Format(PyExc_TypeError, __location__ ": Expected type '%s' for '%s' of type '%s'", (type)->tp_name, #var, Py_TYPE(var)->tp_name); \