diff --git a/CHANGES.current b/CHANGES.current index 7d32cdc40..735f33adb 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -25,3 +25,14 @@ Version 2.0.4 (in progress) in python wrappers. For full details and limitations, refer to Doc/Manual/Python.html. A small test suite designed to demonstrate the performance gain is in Examples/python/performance. + +2011-04-09: szager + Applied patch #1932484: migrate PyCObject to PyCapsule. + +2011-04-09: szager + Added preprocessor guards for python functions PyUnicode_AsWideChar and + PySlice_GetIndices, which changed signatures in python3.2. + +2011-04-11: szager + Fixed PyVarObject_HEAD_INIT to eliminate VC++ compiler errors about + static initialization of struct members with pointers. diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index a98d84e0b..c9b772e4b 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -742,7 +742,7 @@ SwigPyObject_TypeOnce(void) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(&PyType_Type, 0) + PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -812,11 +812,13 @@ SwigPyObject_TypeOnce(void) { #endif }; swigpyobject_type = tmp; - /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ -#if PY_VERSION_HEX < 0x03000000 - swigpyobject_type.ob_type = &PyType_Type; -#endif type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpyobject_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpyobject_type) < 0) + return NULL; +#endif } return &swigpyobject_type; } @@ -923,7 +925,7 @@ SwigPyPacked_TypeOnce(void) { const PyTypeObject tmp = { /* PyObject header changed in Python 3 */ #if PY_VERSION_HEX>=0x03000000 - PyVarObject_HEAD_INIT(&PyType_Type, 0) + PyVarObject_HEAD_INIT(NULL, 0) #else PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -989,11 +991,13 @@ SwigPyPacked_TypeOnce(void) { #endif }; swigpypacked_type = tmp; - /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */ -#if PY_VERSION_HEX < 0x03000000 - swigpypacked_type.ob_type = &PyType_Type; -#endif type_init = 1; +#if PY_VERSION_HEX < 0x02020000 + swigpypacked_type.ob_type = &PyType_Type; +#else + if (PyType_Ready(&swigpypacked_type) < 0) + return NULL; +#endif } return &swigpypacked_type; } diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index b0a58422b..dde0b07d1 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -3337,7 +3337,7 @@ public: // PyTypeObject ht_type Printf(f, " {\n"); Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL); - Printv(f, " PyVarObject_HEAD_INIT(&PyType_Type, 0)\n", NIL); + Printv(f, " PyVarObject_HEAD_INIT(NULL, 0)\n", NIL); Printv(f, "#else\n", NIL); Printf(f, " PyObject_HEAD_INIT(NULL)\n"); printSlot(f, getSlot(), "ob_size");