-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-123961: Improve curses C API cleanup #124907
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that traverse() and clear() methods make sense before window_type becomes a heap type.
No you're right but I think it would reduce the diff later. At runtime, they will be unused since the type is not a heap type (so they won't even be called). Whenever a new capsule is created, we just have the check that would be effective at runtime. if (_PyType_HasFeature(_PyType_CAST(window_type), Py_TPFLAGS_HEAPTYPE)) { But if you prefer to have it in the PR which moves it to a heap type, I can do it. |
Since I don't know when I'll move it to heap types, I'll delay their addition until then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merged, thanks. |
This PR moves some functions closer to where they are needed and adds the traversal and clear functions in prepartion to make the window type a heap type.
Note
I always hated dealing with void pointers so I'm grateful if you carefully check that I didn't introduce some decaying calls or weird stuff. In addition, please check that the names were carefully refactored (the functions look all the same and it's very simple to make typos!).
_cursesmodule.c
to fix reference leaks #123961