classification
Title: Deprecate _PyObject_GC_TRACK() in Python 3.6
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2018-11-13 11:49 by vstinner, last changed 2018-11-13 14:01 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10511 merged vstinner, 2018-11-13 11:54
PR 10512 merged miss-islington, 2018-11-13 12:06
Messages (4)
msg329829 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-13 11:49
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.
msg329831 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-13 11:55
> These macros have been broken in Python 3.7 by Eric Snow's work on moving internal APIs to Include/internal/ (...)

Oh, I forgot to mention that IMHO it's perfectly fine :-)
msg329832 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-13 12:06
New changeset 55b4771d5d18d5ff7c095aa1ab750fe0c8bb5e67 by Victor Stinner in branch '3.7':
bpo-35229: Deprecate _PyObject_GC_TRACK() (GH-10511)
https://github.com/python/cpython/commit/55b4771d5d18d5ff7c095aa1ab750fe0c8bb5e67
msg329836 - (view) Author: miss-islington (miss-islington) Date: 2018-11-13 12:14
New changeset 60a6baef4005a32fb4cf45e15942ea18e59ecf19 by Miss Islington (bot) in branch '3.6':
bpo-35229: Deprecate _PyObject_GC_TRACK() (GH-10511)
https://github.com/python/cpython/commit/60a6baef4005a32fb4cf45e15942ea18e59ecf19
History
Date User Action Args
2018-11-13 14:01:22vstinnersetstatus: open -> closed
resolution: fixed
components: + Interpreter Core
stage: patch review -> resolved
2018-11-13 12:14:59miss-islingtonsetnosy: + miss-islington
messages: + msg329836
2018-11-13 12:06:24miss-islingtonsetpull_requests: + pull_request9772
2018-11-13 12:06:14vstinnersetmessages: + msg329832
2018-11-13 11:55:43vstinnersetmessages: + msg329831
2018-11-13 11:54:44vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request9771
2018-11-13 11:49:14vstinnercreate