Commit 2b0dc455 authored by Tres Seaver's avatar Tres Seaver

Replace use of ``PyCObject`` APIs with equivalent ``PyCapsule`` APIs,

except under Python 2.6.
    
  N.B.  This change is an ABI incompatibility under Python 2.7:
        extensions built under Python 2.7 against 4.0.x versions of
        ``zope.proxy`` must be rebuilt.
  
Bump target version to '4.1.0' to signal BBB issue.

Enable compilation of dependent modules under Py3k.
parent bea0d112
...@@ -2,10 +2,17 @@ ...@@ -2,10 +2,17 @@
CHANGES CHANGES
======= =======
4.0.2 (unreleased) 4.1.0 (unreleased)
------------------ ------------------
- TBD - Enabled compilation of dependent modules under Py3k.
- Replaced use of ``PyCObject`` APIs with equivalent ``PyCapsule`` APIs,
except under Python 2.6.
N.B. This change is an ABI incompatibility under Python 2.7:
extensions built under Python 2.7 against 4.0.x versions of
``zope.proxy`` must be rebuilt.
4.0.1 (2012-11-21) 4.0.1 (2012-11-21)
------------------ ------------------
......
...@@ -47,7 +47,7 @@ else: ...@@ -47,7 +47,7 @@ else:
features = {'Cwrapper': Cwrapper} features = {'Cwrapper': Cwrapper}
setup(name='zope.proxy', setup(name='zope.proxy',
version = '4.0.2dev', version = '4.1.0dev',
author='Zope Foundation and Contributors', author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org', author_email='zope-dev@zope.org',
description='Generic Transparent Proxies', description='Generic Transparent Proxies',
......
...@@ -38,6 +38,11 @@ static PyObject * ...@@ -38,6 +38,11 @@ static PyObject *
empty_tuple = NULL; empty_tuple = NULL;
#if PY_VERSION_HEX < 0x02070000
#define PyCapsule_New(pointer, name, destr) \
PyCObject_FromVoidPtr(pointer, destr)
#endif
// Compatibility with Python 2 // Compatibility with Python 2
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
#define IS_STRING PyString_Check #define IS_STRING PyString_Check
...@@ -53,9 +58,6 @@ empty_tuple = NULL; ...@@ -53,9 +58,6 @@ empty_tuple = NULL;
#define MOD_DEF(ob, name, doc, methods) \ #define MOD_DEF(ob, name, doc, methods) \
ob = Py_InitModule3(name, methods, doc); ob = Py_InitModule3(name, methods, doc);
#define PyCapsule_New(pointer, name, destr) \
PyCObject_FromVoidPtr(pointer, destr)
#else #else
#define IS_STRING PyUnicode_Check #define IS_STRING PyUnicode_Check
......
...@@ -15,7 +15,6 @@ typedef struct { ...@@ -15,7 +15,6 @@ typedef struct {
PyObject *(*getobject)(PyObject *proxy); PyObject *(*getobject)(PyObject *proxy);
} ProxyInterface; } ProxyInterface;
#ifndef PROXY_MODULE #ifndef PROXY_MODULE
/* These are only defined in the public interface, and are not /* These are only defined in the public interface, and are not
...@@ -33,9 +32,15 @@ Proxy_Import(void) ...@@ -33,9 +32,15 @@ Proxy_Import(void)
if (m != NULL) { if (m != NULL) {
PyObject *tmp = PyObject_GetAttrString(m, "_CAPI"); PyObject *tmp = PyObject_GetAttrString(m, "_CAPI");
if (tmp != NULL) { if (tmp != NULL) {
#if PY_VERSION_HEX < 0x02070000
if (PyCObject_Check(tmp)) if (PyCObject_Check(tmp))
_proxy_api = (ProxyInterface *) _proxy_api = (ProxyInterface *)
PyCObject_AsVoidPtr(tmp); PyCObject_AsVoidPtr(tmp);
#else
if (PyCapsule_CheckExact(tmp))
_proxy_api = (ProxyInterface *)
PyCapsule_GetPointer(tmp, NULL);
#endif
Py_DECREF(tmp); Py_DECREF(tmp);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment