diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg index 1d892375c..0107c52d5 100644 --- a/Lib/python/builtin.swg +++ b/Lib/python/builtin.swg @@ -433,10 +433,19 @@ SwigPyStaticVar_Type(void) { 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; staticvar_type = tmp; diff --git a/Lib/python/pyinit.swg b/Lib/python/pyinit.swg index e71c72b27..2e21b8265 100644 --- a/Lib/python/pyinit.swg +++ b/Lib/python/pyinit.swg @@ -183,10 +183,19 @@ swig_varlink_type(void) { 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; varlink_type = tmp; diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 85ff2763e..0215b4072 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -725,7 +725,9 @@ SwigPyObject_TypeOnce(void) { (unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_hex, /*nb_hex*/ #endif -#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */ +#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ +#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ @@ -805,10 +807,19 @@ SwigPyObject_TypeOnce(void) { 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; swigpyobject_type = tmp; @@ -984,10 +995,19 @@ SwigPyPacked_TypeOnce(void) { 0, /* tp_del */ #endif #if PY_VERSION_HEX >= 0x02060000 - 0, /* tp_version */ + 0, /* tp_version_tag */ +#endif +#if PY_VERSION_HEX >= 0x03040000 + 0, /* tp_finalize */ #endif #ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ + 0, /* tp_allocs */ + 0, /* tp_frees */ + 0, /* tp_maxalloc */ +#if PY_VERSION_HEX >= 0x02050000 + 0, /* tp_prev */ +#endif + 0 /* tp_next */ #endif }; swigpypacked_type = tmp; diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index e91047a39..5aff24278 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -4050,6 +4050,18 @@ public: Printv(f, "#if PY_VERSION_HEX >= 0x02060000\n", NIL); printSlot(f, getSlot(n, "feature:python:tp_version_tag"), "tp_version_tag", "int"); Printv(f, "#endif\n", NIL); + Printv(f, "#if PY_VERSION_HEX >= 0x03040000\n", NIL); + printSlot(f, getSlot(n, "feature:python:tp_finalize"), "tp_finalize", "destructor"); + Printv(f, "#endif\n", NIL); + Printv(f, "#ifdef COUNT_ALLOCS\n", NIL); + printSlot(f, getSlot(), "tp_allocs", "Py_ssize_t"); + printSlot(f, getSlot(), "tp_frees", "Py_ssize_t"); + printSlot(f, getSlot(), "tp_maxalloc", "Py_ssize_t"); + Printv(f, "#if PY_VERSION_HEX >= 0x02050000\n", NIL); + printSlot(f, getSlot(), "tp_prev", "struct _typeobject*"); + Printv(f, "#endif\n", NIL); + printSlot(f, getSlot(), "tp_next", "struct _typeobject*"); + Printv(f, "#endif\n", NIL); Printf(f, " },\n"); // PyAsyncMethods as_async @@ -4161,9 +4173,15 @@ public: Printv(f, "#endif\n", NIL); Printf(f, " },\n"); - // PyObject *ht_name, *ht_slots + // PyObject *ht_name, *ht_slots, *ht_qualname; printSlot(f, getSlot(n, "feature:python:ht_name"), "ht_name", "PyObject*"); printSlot(f, getSlot(n, "feature:python:ht_slots"), "ht_slots", "PyObject*"); + Printv(f, "#if PY_VERSION_HEX >= 0x03030000\n", NIL); + printSlot(f, getSlot(n, "feature:python:ht_qualname"), "ht_qualname", "PyObject*"); + + // struct _dictkeysobject *ht_cached_keys; + printSlot(f, getSlot(n, "feature:python:ht_cached_keys"), "ht_cached_keys", "struct _dictkeysobject*"); + Printv(f, "#endif\n", NIL); Printf(f, "};\n\n"); String *clientdata = NewString(""); diff --git a/Tools/testflags.py b/Tools/testflags.py index 76389f046..63a3b4645 100755 --- a/Tools/testflags.py +++ b/Tools/testflags.py @@ -15,7 +15,7 @@ def get_cflags(language, std, compiler): "octave":"-Werror " + c_common, "perl5":"-Werror " + c_common, "php":"-Werror " + c_common, - "python":"-Werror " + c_common, + "python":"-Werror " + c_common + " -Wmissing-field-initializers", "r":"-Werror " + c_common, "ruby":"-Werror " + c_common, "scilab":"-Werror " + c_common, @@ -44,7 +44,7 @@ def get_cxxflags(language, std, compiler): "octave":"-Werror " + cxx_common, "perl5":"-Werror " + cxx_common, "php":"-Werror " + cxx_common, - "python":"-Werror " + cxx_common, + "python":"-Werror " + cxx_common + " -Wmissing-field-initializers", "r":"-Werror " + cxx_common, "ruby":"-Werror " + cxx_common, "scilab": cxx_common,