| |
@@ -0,0 +1,37 @@
|
| |
+ From 2e42734d61f68407d6a74a3a37d24222085f0f28 Mon Sep 17 00:00:00 2001
|
| |
+ From: Victor Stinner <vstinner@python.org>
|
| |
+ Date: Wed, 13 Dec 2023 16:16:04 +0100
|
| |
+ Subject: [PATCH] fix: make_static_property_type()
|
| |
+
|
| |
+ Update make_static_property_type() to make it compatible with Python
|
| |
+ 3.13: set Py_TPFLAGS_MANAGED_DICT flag before calling PyType_Ready().
|
| |
+ ---
|
| |
+ include/pybind11/detail/class.h | 9 ++++-----
|
| |
+ 1 file changed, 4 insertions(+), 5 deletions(-)
|
| |
+
|
| |
+ diff --git a/include/pybind11/detail/class.h b/include/pybind11/detail/class.h
|
| |
+ index b317271674..60fed8dc65 100644
|
| |
+ --- a/include/pybind11/detail/class.h
|
| |
+ +++ b/include/pybind11/detail/class.h
|
| |
+ @@ -86,17 +86,16 @@ inline PyTypeObject *make_static_property_type() {
|
| |
+ type->tp_descr_get = pybind11_static_get;
|
| |
+ type->tp_descr_set = pybind11_static_set;
|
| |
+
|
| |
+ - 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
|
| |
+
|
| |
+ + if (PyType_Ready(type) < 0) {
|
| |
+ + pybind11_fail("make_static_property_type(): failure in PyType_Ready()!");
|
| |
+ + }
|
| |
+ +
|
| |
+ setattr((PyObject *) type, "__module__", str("pybind11_builtins"));
|
| |
+ PYBIND11_SET_OLDPY_QUALNAME(type, name_obj);
|
| |
+
|
| |