summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2011-04-09 20:31:07 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2011-04-09 20:31:07 +0000
commit8de1425e57fbe867d35b45f32ccedb48c18059fd (patch)
tree159327adedca89826bc573bfc2e4794d973d2c22 /dev-python/greenlet/files
parentFix some net_unittests failures, bug #361939. (diff)
downloadhistorical-8de1425e57fbe867d35b45f32ccedb48c18059fd.tar.gz
historical-8de1425e57fbe867d35b45f32ccedb48c18059fd.tar.bz2
historical-8de1425e57fbe867d35b45f32ccedb48c18059fd.zip
Fix building with Python 3.2 (bug #343385).
Package-Manager: portage-2.2.0_alpha29_p10/cvs/Linux x86_64
Diffstat (limited to 'dev-python/greenlet/files')
-rw-r--r--dev-python/greenlet/files/greenlet-0.3.1-python-3.2.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/dev-python/greenlet/files/greenlet-0.3.1-python-3.2.patch b/dev-python/greenlet/files/greenlet-0.3.1-python-3.2.patch
new file mode 100644
index 000000000000..d4b158b54016
--- /dev/null
+++ b/dev-python/greenlet/files/greenlet-0.3.1-python-3.2.patch
@@ -0,0 +1,50 @@
+https://bitbucket.org/ambroff/greenlet/changeset/f61fffb6feeb
+
+--- greenlet.c
++++ greenlet.c
+@@ -1267,7 +1267,11 @@
+ _PyGreenlet_API[PyGreenlet_SetParent_NUM] =
+ (void *) PyGreenlet_SetParent;
+
++#ifdef GREENLET_USE_PYCAPSULE
++ c_api_object = PyCapsule_New((void *) _PyGreenlet_API, "greenlet._C_API", NULL);
++#else
+ c_api_object = PyCObject_FromVoidPtr((void *) _PyGreenlet_API, NULL);
++#endif
+ if (c_api_object != NULL)
+ {
+ PyModule_AddObject(m, "_C_API", c_api_object);
+--- greenlet.h
++++ greenlet.h
+@@ -31,6 +31,10 @@
+ #define PyGreenlet_ACTIVE(op) (((PyGreenlet*)(op))->stack_start != NULL)
+ #define PyGreenlet_GET_PARENT(op) (((PyGreenlet*)(op))->parent)
+
++#if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 1) || PY_MAJOR_VERSION > 3
++#define GREENLET_USE_PYCAPSULE
++#endif
++
+ /* C API functions */
+
+ /* Total number of symbols that are exported */
+@@ -108,6 +112,12 @@
+ _PyGreenlet_API[PyGreenlet_SetParent_NUM])
+
+ /* Macro that imports greenlet and initializes C API */
++#ifdef GREENLET_USE_PYCAPSULE
++#define PyGreenlet_Import() \
++{ \
++ _PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \
++}
++#else
+ #define PyGreenlet_Import() \
+ { \
+ PyObject *module = PyImport_ImportModule("greenlet"); \
+@@ -122,6 +132,7 @@
+ Py_DECREF(module); \
+ } \
+ }
++#endif
+
+ #endif /* GREENLET_MODULE */
+