-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-118789: Add PyUnstable_Object_ClearWeakRefsNoCallbacks
#118807
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
Changes from all commits
f1fc2bc
9330f51
dc28627
652c1c1
519a347
29582a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -96,3 +96,19 @@ as much as it can. | |||||
This iterates through the weak references for *object* and calls callbacks | ||||||
for those references which have one. It returns when all callbacks have | ||||||
been attempted. | ||||||
|
||||||
|
||||||
.. c:function:: void PyUnstable_Object_ClearWeakRefsNoCallbacks(PyObject *object) | ||||||
|
||||||
Clears the weakrefs for *object* without calling the callbacks. | ||||||
|
||||||
This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler | ||||||
for types with finalizers (i.e., :meth:`~object.__del__`). The handler for | ||||||
those objects first calls :c:func:`PyObject_ClearWeakRefs` to clear weakrefs | ||||||
and call their callbacks, then the finalizer, and finally this function to | ||||||
clear any weakrefs that may have been created by the finalizer. | ||||||
|
||||||
In most circumstances, it's more appropriate to use | ||||||
:c:func:`PyObject_ClearWeakRefs` to clear weakrefs instead of this function. | ||||||
|
||||||
.. versionadded:: 3.13 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO it's too late for 3.13, we're past beta1.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Yhg1s - is it okay to make this function public in 3.13? From our discussion on Discord in May, it sounded like you were okay with this before the RC, but I'd like to make sure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, considering the circumstances, this is reasonable to add in beta 3. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Add :c:func:`PyUnstable_Object_ClearWeakRefsNoCallbacks`, which clears | ||
weakrefs without calling their callbacks. |
Uh oh!
There was an error while loading. Please reload this page.