diff options
author | Johan Dahlin <johan@src.gnome.org> | 2006-06-05 19:35:50 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2006-06-05 19:35:50 +0000 |
commit | 207893a121480d909fe54be065a8e95e54289695 (patch) | |
tree | de57ccf100942c710f5da234770379d486989d6e /gobject/pygobject-private.h | |
parent | 233fc308763d7682035d14093af76f43591bec13 (diff) | |
download | pygobject-207893a121480d909fe54be065a8e95e54289695.tar.gz |
Add Py_CLEAR macro for 2.3 compatibility
Diffstat (limited to 'gobject/pygobject-private.h')
-rw-r--r-- | gobject/pygobject-private.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h index eb4074de..b6225636 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 { \ |