encukou · GitHub

There are newly documented restrictions on tp_traverse:
    The traversal function must not have any side effects.
    It must not modify the reference counts of any Python
    objects nor create or destroy any Python objects.
* Add several functions that are guaranteed side-effect-free,
  with a _DuringGC suffix.
* Use these in ctypes
* Consolidate tp_traverse docs in gcsupport.rst, moving unique
  content from typeobj.rst there

@encukou

Open

@encukou

zooba

vstinner

Co-authored-by: Victor Stinner <vstinner@python.org>

@encukou

@encukou

vstinner

@encukou

encukou marked this pull request as ready for review

March 19, 2026 12:27

@encukou

@encukou

@encukou

@encukou

@encukou

@encukou

ljfp pushed a commit to ljfp/cpython that referenced this pull request

Apr 25, 2026
…145925)
There are newly documented restrictions on tp_traverse:
    The traversal function must not have any side effects.
    It must not modify the reference counts of any Python
    objects nor create or destroy any Python objects.
* Add several functions that are guaranteed side-effect-free,
  with a _DuringGC suffix.
* Use these in ctypes
* Consolidate tp_traverse docs in gcsupport.rst, moving unique
  content from typeobj.rst there
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>

Read the original on github.com ↗