-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
GH-92678: Expose managed dict clear and visit functions #95246
GH-92678: Expose managed dict clear and visit functions #95246
Conversation
I'm going with this solution instead of https://github.com/python/cpython/pull/95242/files because I really don't want to modify As these functions are marked as unstable API functions, we have some space to proceed if we need to adapt things around, but for the time being is good enough for now. If this proves insufficient, or the breakage is to big, we can always try the automatic way in @markshannon @Fidget-Spinner Please, after I merge this, make a PR adding this change to the what's new for 3.11 on "how to port to Python 3.11" (and mark the issue as a blocker so we don't forget to merge it). |
@@ -83,3 +83,6 @@ typedef struct { | |||
|
|||
PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *); | |||
PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other); | |||
|
|||
PyAPI_FUNC(int) _PyObject_VisitManagedDict(PyObject *self, visitproc visit, void *arg); |
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 think this is quite a bit weird: these functions receive an object and then visit/clear the dict. This is not an API for dictionary objects, it's an API for instances so I think it should not be here but in object.h
or some other header.
Looking at these functions, at first sight, it seems that "self" is the dictionary and not the oject.
I'm merging the PR to get this into beta 5. We can address moving the functions to a different header and the docs later. |
Thanks @markshannon for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, @markshannon and @pablogsal, I could not cleanly backport this to |
…ythonGH-95246). (cherry picked from commit 27055d7) Co-authored-by: Mark Shannon <[email protected]>
). (#95256) Co-authored-by: Mark Shannon <[email protected]>
GH-95647 is a backport of this pull request to the 3.11 branch. |
Adds the unstable API functions
I've only added a test for
_PyObject_ClearManagedDict
as there doesn't seem to be a straightforward way to test the visit function.