diff options
author | James Meyer <jams@linhes.org> | 2010-12-10 01:32:23 (GMT) |
---|---|---|
committer | James Meyer <jams@linhes.org> | 2010-12-10 01:32:23 (GMT) |
commit | 5c40bb464357d486339e90f4118e4adaa8989e09 (patch) | |
tree | 8b5f680e7867c24eb5f3d1347eef9ea19c92beeb /abs/core/python_modules/pygtk/python27.patch | |
parent | f9b90df04a227fb2607482bed9a2f56678d95d30 (diff) | |
parent | 59771e9d114b75eafb316e94b7612dda202edd83 (diff) | |
download | linhes_pkgbuild-5c40bb464357d486339e90f4118e4adaa8989e09.zip linhes_pkgbuild-5c40bb464357d486339e90f4118e4adaa8989e09.tar.gz linhes_pkgbuild-5c40bb464357d486339e90f4118e4adaa8989e09.tar.bz2 |
Merge branch 'testing' of ssh://linhes.org/mount/repository/linhes_pkgbuild into testing
Diffstat (limited to 'abs/core/python_modules/pygtk/python27.patch')
-rw-r--r-- | abs/core/python_modules/pygtk/python27.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/abs/core/python_modules/pygtk/python27.patch b/abs/core/python_modules/pygtk/python27.patch new file mode 100644 index 0000000..9bbe2b5 --- /dev/null +++ b/abs/core/python_modules/pygtk/python27.patch @@ -0,0 +1,50 @@ +diff --git a/gtk/gtkmodule.c b/gtk/gtkmodule.c +index c0e1493..aa8cf10 100644 +--- a/gtk/gtkmodule.c ++++ b/gtk/gtkmodule.c +@@ -227,8 +227,12 @@ init_gtk(void) + pygtk_add_stock_items(d); + + /* extension API */ +- PyDict_SetItemString(d, "_PyGtk_API", +- o=PyCObject_FromVoidPtr(&functions, NULL)); ++#if PY_VERSION_HEX >= 0x02070000 ++ o = PyCapsule_New(&functions, "gtk._gtk._PyGtk_API", NULL); ++#else ++ o = PyCObject_FromVoidPtr(&functions, NULL); ++#endif ++ PyDict_SetItemString(d, "_PyGtk_API", o); + Py_DECREF(o); + + PyGtkDeprecationWarning = PyErr_NewException("gtk.GtkDeprecationWarning", +diff --git a/gtk/pygtk.h b/gtk/pygtk.h +index 573c3b9..e4c680f 100644 +--- a/gtk/pygtk.h ++++ b/gtk/pygtk.h +@@ -60,6 +60,18 @@ struct _PyGtk_FunctionStruct *_PyGtk_API; + + + /* a function to initialise the pygtk functions */ ++ ++/* Python 2.7 introduced the PyCapsule API and deprecated the CObject API */ ++#if PY_VERSION_HEX >= 0x02070000 ++#define init_pygtk() G_STMT_START { \ ++ void *capsule = PyCapsule_Import("gtk._gtk._PyGtk_API", 0); \ ++ if (!capsule) { \ ++ return; \ ++ } \ ++ _PyGtk_API = (struct _PyGtk_FunctionStruct*)capsule; \ ++} G_STMT_END ++#else /* PY_VERSION_HEX */ ++/* Python 2.6 and earlier use the CObject API */ + #define init_pygtk() G_STMT_START { \ + PyObject *pygtk = PyImport_ImportModule("gtk"); \ + if (pygtk != NULL) { \ +@@ -79,6 +91,7 @@ struct _PyGtk_FunctionStruct *_PyGtk_API; + return; \ + } \ + } G_STMT_END ++#endif /* PY_VERSION_HEX */ + + #endif + |