From 8de1425e57fbe867d35b45f32ccedb48c18059fd Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> Date: Sat, 9 Apr 2011 20:31:07 +0000 Subject: Fix building with Python 3.2 (bug #343385). Package-Manager: portage-2.2.0_alpha29_p10/cvs/Linux x86_64 --- .../greenlet/files/greenlet-0.3.1-python-3.2.patch | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 dev-python/greenlet/files/greenlet-0.3.1-python-3.2.patch (limited to 'dev-python/greenlet/files') 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 */ + -- cgit v1.2.3-65-gdbad