[Python] Replace tp_print with tp_vectorcall_offset slot for Python 3.8

The tp_print slot is no longer supported and replaced with tp_vectorcall_offset.
The (printfunc) cast that we used caused problems on PyPy.

Fixes #2262
This commit is contained in:
Kris Thielemans 2022-04-21 12:28:54 +01:00
commit f5934b099b
3 changed files with 29 additions and 5 deletions

View file

@ -211,7 +211,11 @@ SwigPyStaticVar_Type(void) {
sizeof(PyGetSetDescrObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
0, /* tp_print */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
#endif
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
@ -295,7 +299,11 @@ SwigPyObjectType(void) {
PyType_Type.tp_basicsize, /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
0, /* tp_print */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
#endif
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */

View file

@ -348,7 +348,11 @@ swig_varlink_type(void) {
sizeof(swig_varlinkobject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor) swig_varlink_dealloc, /* tp_dealloc */
0, /* tp_print */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
#endif
(getattrfunc) swig_varlink_getattr, /* tp_getattr */
(setattrfunc) swig_varlink_setattr, /* tp_setattr */
0, /* tp_compare */
@ -914,7 +918,11 @@ SwigPyObject_TypeOnce(void) {
sizeof(SwigPyObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
0, /* tp_print */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
#endif
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000
@ -1090,7 +1098,11 @@ SwigPyPacked_TypeOnce(void) {
sizeof(SwigPyPacked), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyPacked_dealloc, /* tp_dealloc */
0, /* tp_print */
#if PY_VERSION_HEX < 0x030800b4
(printfunc)0, /*tp_print*/
#else
(Py_ssize_t)0, /*tp_vectorcall_offset*/
#endif
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX>=0x03000000