[Checkins] SVN: zope.proxy/trunk/ Replace use of ``PyCObject`` APIs with equivalent ``PyCapsule`` APIs,

Tres Seaver cvs-admin at zope.org
Wed Dec 19 17:53:07 UTC 2012


Log message for revision 128784:
  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.
  

Changed:
  _U  zope.proxy/trunk/
  U   zope.proxy/trunk/CHANGES.txt
  U   zope.proxy/trunk/setup.py
  U   zope.proxy/trunk/src/zope/proxy/_zope_proxy_proxy.c
  U   zope.proxy/trunk/src/zope/proxy/proxy.h

-=-
Modified: zope.proxy/trunk/CHANGES.txt
===================================================================
--- zope.proxy/trunk/CHANGES.txt	2012-12-19 17:34:18 UTC (rev 128783)
+++ zope.proxy/trunk/CHANGES.txt	2012-12-19 17:53:06 UTC (rev 128784)
@@ -2,11 +2,18 @@
 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)
 ------------------
 

Modified: zope.proxy/trunk/setup.py
===================================================================
--- zope.proxy/trunk/setup.py	2012-12-19 17:34:18 UTC (rev 128783)
+++ zope.proxy/trunk/setup.py	2012-12-19 17:53:06 UTC (rev 128784)
@@ -47,7 +47,7 @@
     features = {'Cwrapper': Cwrapper}
 
 setup(name='zope.proxy',
-      version = '4.0.2dev',
+      version = '4.1.0dev',
       author='Zope Foundation and Contributors',
       author_email='zope-dev at zope.org',
       description='Generic Transparent Proxies',

Modified: zope.proxy/trunk/src/zope/proxy/_zope_proxy_proxy.c
===================================================================
--- zope.proxy/trunk/src/zope/proxy/_zope_proxy_proxy.c	2012-12-19 17:34:18 UTC (rev 128783)
+++ zope.proxy/trunk/src/zope/proxy/_zope_proxy_proxy.c	2012-12-19 17:53:06 UTC (rev 128784)
@@ -38,6 +38,11 @@
 empty_tuple = NULL;
 
 
+#if PY_VERSION_HEX <  0x02070000
+  #define PyCapsule_New(pointer, name, destr) \
+          PyCObject_FromVoidPtr(pointer, destr)
+#endif
+
 // Compatibility with Python 2
 #if PY_MAJOR_VERSION < 3
   #define IS_STRING PyString_Check
@@ -53,9 +58,6 @@
   #define MOD_DEF(ob, name, doc, methods) \
           ob = Py_InitModule3(name, methods, doc);
 
-  #define PyCapsule_New(pointer, name, destr) \
-          PyCObject_FromVoidPtr(pointer, destr)
-
 #else
 
   #define IS_STRING PyUnicode_Check

Modified: zope.proxy/trunk/src/zope/proxy/proxy.h
===================================================================
--- zope.proxy/trunk/src/zope/proxy/proxy.h	2012-12-19 17:34:18 UTC (rev 128783)
+++ zope.proxy/trunk/src/zope/proxy/proxy.h	2012-12-19 17:53:06 UTC (rev 128784)
@@ -15,7 +15,6 @@
     PyObject *(*getobject)(PyObject *proxy);
 } ProxyInterface;
 
-
 #ifndef PROXY_MODULE
 
 /* These are only defined in the public interface, and are not
@@ -33,9 +32,15 @@
         if (m != NULL) {
             PyObject *tmp = PyObject_GetAttrString(m, "_CAPI");
             if (tmp != NULL) {
+#if PY_VERSION_HEX <  0x02070000
                 if (PyCObject_Check(tmp))
                     _proxy_api = (ProxyInterface *)
                         PyCObject_AsVoidPtr(tmp);
+#else
+                if (PyCapsule_CheckExact(tmp))
+                    _proxy_api = (ProxyInterface *)
+                        PyCapsule_GetPointer(tmp, NULL);
+#endif
                 Py_DECREF(tmp);
             }
         }



More information about the checkins mailing list