From f10c2fdc39f7651b2acf602f41410c1b6e0bb85e Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 5 Aug 2022 08:09:16 -0700 Subject: [PATCH] Undo attr.h, detail/class.h changes made under PR #3923. See https://github.com/python/cpython/issues/92678 for background. --- include/pybind11/attr.h | 4 ---- include/pybind11/detail/class.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index db7cd8efff..65e223a36a 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -345,11 +345,7 @@ struct type_record { bases.append((PyObject *) base_info->type); -#if PY_VERSION_HEX < 0x030B0000 dynamic_attr |= base_info->type->tp_dictoffset != 0; -#else - dynamic_attr |= (base_info->type->tp_flags & Py_TPFLAGS_MANAGED_DICT) != 0; -#endif if (caster) { base_info->implicit_casts.emplace_back(type, caster); diff --git a/include/pybind11/detail/class.h b/include/pybind11/detail/class.h index a98e5e5414..fc6d73f02d 100644 --- a/include/pybind11/detail/class.h +++ b/include/pybind11/detail/class.h @@ -524,12 +524,8 @@ extern "C" inline int pybind11_clear(PyObject *self) { inline void enable_dynamic_attributes(PyHeapTypeObject *heap_type) { auto *type = &heap_type->ht_type; type->tp_flags |= Py_TPFLAGS_HAVE_GC; -#if PY_VERSION_HEX < 0x030B0000 type->tp_dictoffset = type->tp_basicsize; // place dict at the end type->tp_basicsize += (ssize_t) sizeof(PyObject *); // and allocate enough space for it -#else - type->tp_flags |= Py_TPFLAGS_MANAGED_DICT; -#endif type->tp_traverse = pybind11_traverse; type->tp_clear = pybind11_clear;