diff --git a/CHANGES.current b/CHANGES.current index 7e7232383..616d973c9 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.1.0 (in progress) =========================== +2022-08-01: wsfulton + [Python] Add initialisers for additional members in PyHeapTypeObject + (builtin mode) for Python-3.11 - _ht_tpname, _spec_cache. + 2022-07-30: wsfulton C++20 has deprecated std::basic_string<>::reserve() and the C++11 method std::basic_string<>::shrink_to_fit() is a replacement that can be used. diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg index f31fccf1e..5cff6835f 100644 --- a/Lib/python/builtin.swg +++ b/Lib/python/builtin.swg @@ -426,7 +426,7 @@ SwigPyBuiltin_ThisClosure (PyObject *self, void *SWIGUNUSEDPARM(closure)) { SWIGINTERN void SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype) { -#if PY_VERSION_HEX >= 0x030900A4 +#if PY_VERSION_HEX >= 0x030900a4 Py_SET_TYPE(type, metatype); #else Py_TYPE(type) = metatype; diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 9aac91601..2d2ac4f5f 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -4348,9 +4348,20 @@ public: printSlot(f, getSlot(n, "feature:python:ht_cached_keys"), "ht_cached_keys"); Printv(f, "#endif\n", NIL); + // PyObject *ht_module; Printv(f, "#if PY_VERSION_HEX >= 0x03090000\n", NIL); printSlot(f, getSlot(n, "feature:python:ht_module"), "ht_module", "PyObject *"); Printv(f, "#endif\n", NIL); + + // char *_ht_tpname; + Printv(f, "#if PY_VERSION_HEX >= 0x030b0000\n", NIL); + printSlot(f, getSlot(n, "feature:python:_ht_tpname"), "_ht_tpname", "char *"); + + // struct _specialization_cache _spec_cache; + Printf(f, " {\n"); + printSlot(f, getSlot(n, "feature:python:getitem"), "getitem", "PyObject *"); + Printf(f, " }\n"); + Printv(f, "#endif\n", NIL); Printf(f, "};\n\n"); String *clientdata = NewString("");