pygobject r890 - in trunk: . glib gobject



Author: johan
Date: Mon Jul 28 09:14:58 2008
New Revision: 890
URL: http://svn.gnome.org/viewvc/pygobject?rev=890&view=rev

Log:
2008-07-28  Johan Dahlin  <johan gnome org>

    * glib/pyglib-python-compat.h:
    * gobject/pygobject-private.h:
    Move all compatibility into the same place, fixes build
    on python 2.4.



Modified:
   trunk/ChangeLog
   trunk/glib/pyglib-python-compat.h
   trunk/gobject/pygobject-private.h

Modified: trunk/glib/pyglib-python-compat.h
==============================================================================
--- trunk/glib/pyglib-python-compat.h	(original)
+++ trunk/glib/pyglib-python-compat.h	Mon Jul 28 09:14:58 2008
@@ -21,19 +21,34 @@
 #ifndef __PYGLIB_PYTHON_COMPAT_H__
 #define __PYGLIB_PYTHON_COMPAT_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
+
 /* Compilation on Python 2.4 */
 #if PY_VERSION_HEX < 0x02050000
 typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+typedef inquiry lenfunc;
 #endif
 
 /* Compilation on Python 2.x */
 #if PY_VERSION_HEX < 0x03000000
 #define RO READONLY
-#define _PyUnicode_Check PyString_Check 
+#define _PyUnicode_Check PyString_Check
 #define _PyUnicode_AsString PyString_AsString
 #define _PyUnicode_AsStringAndSize PyString_AsStringAndSize
-#define _PyUnicode_FromString PyString_FromString 
-#define _PyUnicode_FromStringAndSize PyString_FromStringAndSize 
+#define _PyUnicode_FromString PyString_FromString
+#define _PyUnicode_FromStringAndSize PyString_FromStringAndSize
 #define _PyUnicode_FromFormat PyString_FromFormat
 #define _PyUnicode_AS_STRING PyString_AS_STRING
 #define _PyUnicode_GET_SIZE PyString_GET_SIZE
@@ -75,16 +90,16 @@
     typename,                                           \
     sizeof(csymbol)                                     \
 };
-#define PYGLIB_REGISTER_TYPE(d, type, name)	        \
+#define PYGLIB_REGISTER_TYPE(d, type, name)	            \
     if (!type.tp_alloc)                                 \
-	type.tp_alloc = PyType_GenericAlloc;            \
+	    type.tp_alloc = PyType_GenericAlloc;            \
     if (!type.tp_new)                                   \
-	type.tp_new = PyType_GenericNew;                \
+	    type.tp_new = PyType_GenericNew;                \
     if (PyType_Ready(&type))                            \
-	return;                                         \
+	    return;                                         \
     PyDict_SetItemString(d, name, (PyObject *)&type);
 
-#define _PyUnicode_Check PyUnicode_Check 
+#define _PyUnicode_Check PyUnicode_Check
 #define _PyUnicode_AsString PyUnicode_AsString
 #define _PyUnicode_AsStringAndSize(obj, buf, size) PyUnicode_AsStringAndSize(obj, size)
 #define _PyUnicode_FromString PyUnicode_FromString

Modified: trunk/gobject/pygobject-private.h
==============================================================================
--- trunk/gobject/pygobject-private.h	(original)
+++ trunk/gobject/pygobject-private.h	Mon Jul 28 09:14:58 2008
@@ -10,25 +10,6 @@
 
 #include "pyglib-python-compat.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
-
-#if PY_VERSION_HEX < 0x02050000
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-typedef inquiry lenfunc;
-#endif
-
 #define PYGOBJECT_REGISTER_GTYPE(d, type, name, gtype)      \
   {                                                         \
     PyObject *o;					    \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]