-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: [CPython 3.11] GC not implemented properly for objects with managed dictionaries #4092
Comments
CC @Skylion007 and @henryiii |
Yikes... and this is will be a 3.11 only fix since we want to switch APIs once the stable APIs from 3.12 are added.... |
I found another potential issue I am trying to address in this PR: #4106 . That atleast moves us to a somewhat stable get_dict / set_dict API. |
Not needed anymore. Fixed upstream in CPython. |
Follow-up: the |
Required prerequisites
Problem description
Pybind11 originally reported a CPython bug at python/cpython#92678. It was later found that the current solution for
Py_TPFLAGS_MANAGED_DICT
implemented by Pybind11 does not properly support GC for their dictionaries.Suggestion: used the newly added (3.11b5) unstable functions:
_PyObject_VisitManagedDict
_PyObject_ClearManagedDict
to properly implement
tp_clear
andtp_traverse
for types withPy_TPFLAGS_MANAGED_DICT
set.Functions were added in https://github.com/python/cpython/pull/95256/files.
Reproducible example code
No response
The text was updated successfully, but these errors were encountered: