Add initialisers for additional members in PyHeapTypeObject

(builtin mode) for Python-3.11 - _ht_tpname, _spec_cache.
This commit is contained in:
William S Fulton 2022-08-01 07:51:04 +01:00
commit 1d56bc6b85
3 changed files with 16 additions and 1 deletions

View file

@ -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.

View file

@ -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;

View file

@ -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("");