diff --git a/include/pybind11/detail/class.h b/include/pybind11/detail/class.h index d73814671b2..528e716f784 100644 --- a/include/pybind11/detail/class.h +++ b/include/pybind11/detail/class.h @@ -89,11 +89,14 @@ inline PyTypeObject *make_static_property_type() { if (PyType_Ready(type) < 0) { pybind11_fail("make_static_property_type(): failure in PyType_Ready()!"); } + # if PY_VERSION_HEX >= 0x030C0000 + // PRE 3.12 FEATURE FREEZE. PLEASE REVIEW AFTER FREEZE. // Since Python-3.12 property-derived types are required to // have dynamic attributes (to set `__doc__`) enable_dynamic_attributes(heap_type); # endif + setattr((PyObject *) type, "__module__", str("pybind11_builtins")); PYBIND11_SET_OLDPY_QUALNAME(type, name_obj);