Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
pablogsal merged 22 commits intopython:mainfromjbower-fb:gcvisitobjs
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
22 commits
Select commitHold shift + click to select a range
c4a91e0
Add PyGC_VisitObjects
jbower-fbFeb 8, 2023
57edf6d
📜🤖 Added by blurb_it.
blurb-it[bot]Feb 18, 2023
447bb53
Remove from Limited API
jbower-fbFeb 18, 2023
d4f9505
Merge branch 'main' into gcvisitobjs
hauntsaninjaFeb 20, 2023
d34a900
Updated to "unstable" API, protect against GC and current object dele…
jbower-fbFeb 23, 2023
7c1fbbb
Merge branch 'gcvisitobjs' of https://github.com/jbower-fb/cpython-jb…
jbower-fbFeb 23, 2023
9b0c461
Fix formatting in Modules/_testcapimodule.c
jbower-fbFeb 23, 2023
29f7f88
Fix formatting in Modules/_testcapimodule.c
jbower-fbFeb 23, 2023
e16f1e3
Fix formatting in Modules/_testcapimodule.c
jbower-fbFeb 23, 2023
024ee30
Fix formatting in Modules/_testcapimodule.c
jbower-fbFeb 23, 2023
bd65abb
Fix formatting in Modules/gcmodule.c
jbower-fbFeb 23, 2023
f03e581
Fix formatting in Modules/gcmodule.c
jbower-fbFeb 23, 2023
16ea0d6
Fix formatting in Modules/gcmodule.c
jbower-fbFeb 23, 2023
369e199
Simplify test in Modules/_testcapimodule.c
jbower-fbFeb 23, 2023
219154a
Address minor review comments and add documentation.
jbower-fbFeb 23, 2023
be5b7f0
Merge branch 'main' into gcvisitobjs
jbower-fbFeb 24, 2023
5752f1c
Update Doc/c-api/gcsupport.rst
jbower-fbMar 11, 2023
1512004
Update Modules/_testcapimodule.c
jbower-fbMar 11, 2023
87a5b56
Update Modules/_testcapimodule.c
jbower-fbMar 11, 2023
295f7dd
Minor doc tweaks from review
jbower-fbMar 11, 2023
ed06dff
Merge branch 'python:main' into gcvisitobjs
jbower-fbMar 11, 2023
620043b
Merge branch 'main' into gcvisitobjs
jbower-fbMar 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Address minor review comments and add documentation.
  • Loading branch information
@jbower-fb
jbower-fb committedFeb 24, 2023
commit219154af15225ed0363da3e1dff32df7d1eeb351
33 changes: 33 additions & 0 deletionsDoc/c-api/gcsupport.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
the garbage collector.

.. c:function:: void PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)

Run supplied callback on all live GC-capable objects.

.. 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.

.. 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.

.. versionadded:: 3.12


View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
Add a new C-API function for iterating over GC'able objects using a callback: ``PyGC_VisitObjects``.
Add a new(unstable)C-API function for iterating over GC'able objects using a callback: ``PyUnstable_VisitObjects``.
2 changes: 1 addition & 1 deletionModules/gcmodule.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2422,6 +2422,6 @@ PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
}
}
}
done:;
done:
gcstate->enabled = origenstate;
}

[8]ページ先頭

©2009-2025 Movatter.jp