[New-bugs-announce] [issue35229] Deprecate _PyObject_GC_TRACK() in Python 3.6

STINNER Victor report at bugs.python.org
Tue Nov 13 06:49:14 EST 2018

New submission from STINNER Victor <vstinner at redhat.com>:

The _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() macros are documented:

* https://docs.python.org/dev/c-api/gcsupport.html#c._PyObject_GC_TRACK
* https://docs.python.org/dev/c-api/gcsupport.html#c._PyObject_GC_UNTRACK

The documentation says "It should not be used for extension modules."

These macros have been broken in Python 3.7 by Eric Snow's work on moving internal APIs to Include/internal/: _PyObject_GC_TRACK() access _PyRuntime.gc.generation0, whereas accessing _PyRuntime requires to include Include/internal/pycore_pystate.h (header previously called Include/internal/pystate.h in Python 3.7) which is not installed by "make install".

My PR 10507 moved these macros to Include/internal/ to clarify that they must not be used outside CPython internals.

I suggest to deprecate them in Python 3.6: just add a note in Python 3.6 and 3.7 documentation.

messages: 329829
nosy: vstinner
priority: normal
severity: normal
status: open
title: Deprecate _PyObject_GC_TRACK() in Python 3.6
versions: Python 3.6, Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list