Fixed PyVarObject_HEAD_INIT calls for VC++.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12634 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fd666c1440
commit
257b75c23c
3 changed files with 26 additions and 11 deletions
|
|
@ -25,3 +25,14 @@ Version 2.0.4 (in progress)
|
||||||
in python wrappers. For full details and limitations, refer to Doc/Manual/Python.html.
|
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
|
A small test suite designed to demonstrate the performance gain is in
|
||||||
Examples/python/performance.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -742,7 +742,7 @@ SwigPyObject_TypeOnce(void) {
|
||||||
const PyTypeObject tmp = {
|
const PyTypeObject tmp = {
|
||||||
/* PyObject header changed in Python 3 */
|
/* PyObject header changed in Python 3 */
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
#else
|
#else
|
||||||
PyObject_HEAD_INIT(NULL)
|
PyObject_HEAD_INIT(NULL)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
|
|
@ -812,11 +812,13 @@ SwigPyObject_TypeOnce(void) {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
swigpyobject_type = tmp;
|
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;
|
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;
|
return &swigpyobject_type;
|
||||||
}
|
}
|
||||||
|
|
@ -923,7 +925,7 @@ SwigPyPacked_TypeOnce(void) {
|
||||||
const PyTypeObject tmp = {
|
const PyTypeObject tmp = {
|
||||||
/* PyObject header changed in Python 3 */
|
/* PyObject header changed in Python 3 */
|
||||||
#if PY_VERSION_HEX>=0x03000000
|
#if PY_VERSION_HEX>=0x03000000
|
||||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
PyVarObject_HEAD_INIT(NULL, 0)
|
||||||
#else
|
#else
|
||||||
PyObject_HEAD_INIT(NULL)
|
PyObject_HEAD_INIT(NULL)
|
||||||
0, /* ob_size */
|
0, /* ob_size */
|
||||||
|
|
@ -989,11 +991,13 @@ SwigPyPacked_TypeOnce(void) {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
swigpypacked_type = tmp;
|
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;
|
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;
|
return &swigpypacked_type;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3337,7 +3337,7 @@ public:
|
||||||
// PyTypeObject ht_type
|
// PyTypeObject ht_type
|
||||||
Printf(f, " {\n");
|
Printf(f, " {\n");
|
||||||
Printv(f, "#if PY_VERSION_HEX >= 0x03000000\n", NIL);
|
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);
|
Printv(f, "#else\n", NIL);
|
||||||
Printf(f, " PyObject_HEAD_INIT(NULL)\n");
|
Printf(f, " PyObject_HEAD_INIT(NULL)\n");
|
||||||
printSlot(f, getSlot(), "ob_size");
|
printSlot(f, getSlot(), "ob_size");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue