You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
The function slp_prepare_slots(PyTypeObject * type) gets called from two places.
From init_stackless_methods(). Here init_stackless_methods() sets Py_TPFLAGS_HAVE_STACKLESS_EXTENSION before calling slp_prepare_slots(). Everything is fine.
From inherit_slots() in typeobject.c by the COPY*() macros. These macros do not set Py_TPFLAGS_HAVE_STACKLESS_EXTENSION. Therefore slp_prepare_slots() gets called
twice.
Fix: Set Py_TPFLAGS_HAVE_STACKLESS_EXTENSION only in slp_prepare_slots()
The allocated PyMappingMethods is never freed
No problem for static types, but it is a problem for heap types. We can free the memory in the tp_dealloc slot function of PyType_Type (Python class type). If Py_TPFLAGS_HAVE_STACKLESS_EXTENSION and Py_TPFLAGS_HEAPTYPE are set, tp_as_mapping was allocated by slp_prepare_slots()