Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.3k
gh-102013: Add PyUnstable_GC_VisitObjects#102014
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
c4a91e0
57edf6d
447bb53
d4f9505
d34a900
7c1fbbb
9b0c461
29f7f88
e16f1e3
024ee30
bd65abb
f03e581
16ea0d6
369e199
219154a
be5b7f0
5752f1c
1512004
87a5b56
295f7dd
ed06dff
620043b
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -228,3 +228,36 @@ garbage collection runs. | ||
Returns the current state, 0 for disabled and 1 for enabled. | ||
.. versionadded:: 3.10 | ||
Querying Garbage Collector State | ||
-------------------------------- | ||
The C-API provides the following inerface for querying information about | ||
jbower-fb marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
the garbage collector. | ||
.. c:function:: void PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg) | ||
Run supplied callback on all live GC-capable objects. | ||
jbower-fb marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. warning:: | ||
If new objects are (de)allocated by the callback it is undefined if they | ||
will be visited. | ||
.. warning:: | ||
Garbage collection is disabled during operation. Explicitly running a collection | ||
in the callback may lead to undefined behaviour e.g. visiting the same objects | ||
multiple times or not at all. | ||
jbower-fb marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. versionadded:: 3.12 | ||
.. c:type:: int (*gcvisitobjects_t)(PyObject *object, void *arg) | ||
Type of the visitor function to be passed to :c:func:`PyUnstable_GC_VisitObjects`. | ||
``arg`` is the same as passed to ``PyUnstable_GC_VisitObjects``. Returning ``0`` | ||
allows iteration to continue, returning ``1`` stops further iteration. Returning any | ||
other value has undefined behavior. | ||
jbower-fb marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
.. versionadded:: 3.12 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Add a new(unstable)C-API function for iterating over GC'able objects using a callback: ``PyUnstable_VisitObjects``. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2422,6 +2422,6 @@ PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg) | ||
} | ||
} | ||
} | ||
done: | ||
gcstate->enabled = origenstate; | ||
} |