Skip to content

Commit c3c60f4

Browse files
committed
fix: workaround CPython inlining
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 78221e9 commit c3c60f4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/pybind11/detail/class.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ extern "C" inline int pybind11_traverse(PyObject *self, visitproc visit, void *a
568568

569569
/// dynamic_attr: Allow the GC to clear the dictionary.
570570
extern "C" inline int pybind11_clear(PyObject *self) {
571-
#if PY_VERSION_HEX >= 0x030D0000
571+
#if PY_VERSION_HEX >= 0x030D00A4
572572
PyObject_ClearManagedDict(self);
573573
#else
574574
PyObject *&dict = *_PyObject_GetDictPtr(self);
@@ -586,6 +586,10 @@ inline void enable_dynamic_attributes(PyHeapTypeObject *heap_type) {
586586
type->tp_basicsize += (ssize_t) sizeof(PyObject *); // and allocate enough space for it
587587
#else
588588
type->tp_flags |= Py_TPFLAGS_MANAGED_DICT;
589+
#if PY_VERSION_HEX >= 0x030D00A1
590+
// Workaround for https://github.com/python/cpython/issues/115776
591+
type->tp_flags &= ~Py_TPFLAGS_INLINE_VALUES;
592+
#endif
589593
#endif
590594
type->tp_traverse = pybind11_traverse;
591595
type->tp_clear = pybind11_clear;

0 commit comments

Comments
 (0)