summaryrefslogtreecommitdiffstats
path: root/gobject/pygobject-private.h
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2006-06-05 19:35:50 +0000
committerJohan Dahlin <johan@src.gnome.org>2006-06-05 19:35:50 +0000
commit207893a121480d909fe54be065a8e95e54289695 (patch)
treede57ccf100942c710f5da234770379d486989d6e /gobject/pygobject-private.h
parent233fc308763d7682035d14093af76f43591bec13 (diff)
downloadpygobject-207893a121480d909fe54be065a8e95e54289695.tar.gz
pygobject-207893a121480d909fe54be065a8e95e54289695.tar.xz
pygobject-207893a121480d909fe54be065a8e95e54289695.zip
Add Py_CLEAR macro for 2.3 compatibility
Diffstat (limited to 'gobject/pygobject-private.h')
-rw-r--r--gobject/pygobject-private.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h
index eb4074d..b622563 100644
--- a/gobject/pygobject-private.h
+++ b/gobject/pygobject-private.h
@@ -8,6 +8,18 @@
#define _INSIDE_PYGOBJECT_
#include "pygobject.h"
+/* Python 2.3 does not define Py_CLEAR */
+#ifndef Py_CLEAR
+#define Py_CLEAR(op) \
+ do { \
+ if (op) { \
+ PyObject *tmp = (PyObject *)(op); \
+ (op) = NULL; \
+ Py_DECREF(tmp); \
+ } \
+ } while (0)
+#endif
+
/* from gobjectmodule.c */
extern struct _PyGObject_Functions pygobject_api_functions;
#define pyg_block_threads() G_STMT_START { \