Commit 86236c40 authored by Gediminas Paulauskas's avatar Gediminas Paulauskas

Support Python 3.2

parent 9d3b78a3
...@@ -56,6 +56,7 @@ setup(name='zope.proxy', ...@@ -56,6 +56,7 @@ setup(name='zope.proxy',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.1', 'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Natural Language :: English', 'Natural Language :: English',
'Operating System :: OS Independent'], 'Operating System :: OS Independent'],
keywords='proxy generic transparent', keywords='proxy generic transparent',
......
...@@ -53,9 +53,12 @@ empty_tuple = NULL; ...@@ -53,9 +53,12 @@ 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
#define MAKE_STRING(name) PyBytes_AS_STRING( \ #define MAKE_STRING(name) PyBytes_AS_STRING( \
PyUnicode_AsUTF8String(name)) PyUnicode_AsUTF8String(name))
...@@ -73,6 +76,7 @@ empty_tuple = NULL; ...@@ -73,6 +76,7 @@ empty_tuple = NULL;
#endif #endif
/* /*
* Slot methods. * Slot methods.
*/ */
...@@ -924,7 +928,7 @@ ProxyType = { ...@@ -924,7 +928,7 @@ ProxyType = {
wrap_init, /* tp_init */ wrap_init, /* tp_init */
0, /* tp_alloc */ 0, /* tp_alloc */
wrap_new, /* tp_new */ wrap_new, /* tp_new */
0, /*_PyObject_GC_Del,*/ /* tp_free */ 0, /*PyObject_GC_Del,*/ /* tp_free */
}; };
static PyObject * static PyObject *
...@@ -1217,7 +1221,7 @@ MOD_INIT(_zope_proxy_proxy) ...@@ -1217,7 +1221,7 @@ MOD_INIT(_zope_proxy_proxy)
if (empty_tuple == NULL) if (empty_tuple == NULL)
empty_tuple = PyTuple_New(0); empty_tuple = PyTuple_New(0);
ProxyType.tp_free = _PyObject_GC_Del; ProxyType.tp_free = PyObject_GC_Del;
if (PyType_Ready(&ProxyType) < 0) if (PyType_Ready(&ProxyType) < 0)
return MOD_ERROR_VAL; return MOD_ERROR_VAL;
...@@ -1226,7 +1230,7 @@ MOD_INIT(_zope_proxy_proxy) ...@@ -1226,7 +1230,7 @@ MOD_INIT(_zope_proxy_proxy)
PyModule_AddObject(m, "ProxyBase", (PyObject *)&ProxyType); PyModule_AddObject(m, "ProxyBase", (PyObject *)&ProxyType);
if (api_object == NULL) { if (api_object == NULL) {
api_object = PyCObject_FromVoidPtr(&wrapper_capi, NULL); api_object = PyCapsule_New(&wrapper_capi, NULL, NULL);
if (api_object == NULL) if (api_object == NULL)
return MOD_ERROR_VAL; return MOD_ERROR_VAL;
} }
......
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