From 2026df3a2cfcfc75bf1806357bc1c746da972e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 20 Feb 2025 16:23:07 +0100 Subject: [PATCH] Sync `Py_TPFLAGS_MANAGED_DICT` for PyPy3.11 across the codebase Adjust the `Py_TPFLAGS_MANAGED_DICT` logic in `include/pybind11/attr.h` to match the one used in `include/pybind11/detail/class.h`. This is a followup to #5508. --- include/pybind11/attr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index c863d8be5b..b389032e54 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -359,7 +359,8 @@ struct type_record { bases.append((PyObject *) base_info->type); -#if PY_VERSION_HEX < 0x030B0000 +// Keep in sync with enable_dynamic_attributes() in detail/class.h +#if PY_VERSION_HEX < 0x030B0000 || defined(PYPY_VERSION) dynamic_attr |= base_info->type->tp_dictoffset != 0; #else dynamic_attr |= (base_info->type->tp_flags & Py_TPFLAGS_MANAGED_DICT) != 0;