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;