You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better explain the GC contract for PyType_FromSpecWithBases #88429
New changeset a30cbae by Miss Islington (bot) in branch '3.9': bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases (GH-26442) a30cbae
New changeset 11049be by Miss Islington (bot) in branch '3.10': bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases (GH-26442) (GH-26443) 11049be
I reopen the issue. I would prefer to change PyType_FromSpecWithBases() to raise an error if a type has the Py_TPFLAGS_HAVE_GC flag but its tp_traverse function is NULL.
Oops, the Python stdlib has more types than only _ssl.SSLError with this error:
I made sure that it's no longer possible to create a type with Py_TPFLAGS_HAVE_GC flag set but with no traverse function (tp_traverse=NULL). I close again the issue.
Example of bug in the wild: Boost Python enum type defined Py_TPFLAGS_HAVE_GC flag but has no traverse function and instances doesn't have to be tracked by the GC:
Activity
pablogsal commentedon May 29, 2021
We currently don't properly document how PyType_FromSpecWithBases behaves if the class is inheriting from some other class with GC support.
pablogsal commentedon May 29, 2021
New changeset 8b55bc3 by Pablo Galindo in branch 'main':
bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases (GH-26442)
8b55bc3
miss-islington commentedon May 29, 2021
New changeset a30cbae by Miss Islington (bot) in branch '3.9':
bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases (GH-26442)
a30cbae
pablogsal commentedon May 29, 2021
New changeset 11049be by Miss Islington (bot) in branch '3.10':
bpo-44263: Better explain the GC contract for PyType_FromSpecWithBases (GH-26442) (GH-26443)
11049be
pablogsal commentedon May 29, 2021
New changeset 43cf7c8 by Pablo Galindo in branch 'main':
bpo-44263: Mention PyType_Ready in the gc protocol warning (GH-26445)
43cf7c8
miss-islington commentedon May 29, 2021
New changeset 7bd1304 by Miss Islington (bot) in branch '3.9':
bpo-44263: Mention PyType_Ready in the gc protocol warning (GH-26445)
7bd1304
pablogsal commentedon May 29, 2021
New changeset d8ce746 by Miss Islington (bot) in branch '3.10':
bpo-44263: Mention PyType_Ready in the gc protocol warning (GH-26445) (bpo-26446)
d8ce746
vstinner commentedon May 31, 2021
I reopen the issue. I would prefer to change PyType_FromSpecWithBases() to raise an error if a type has the Py_TPFLAGS_HAVE_GC flag but its tp_traverse function is NULL.
Oops, the Python stdlib has more types than only _ssl.SSLError with this error:
vstinner commentedon May 31, 2021
New changeset 142e5c5 by Victor Stinner in branch 'main':
bpo-44263: Fix _decimal and _testcapi GC protocol (GH-26464)
142e5c5
pablogsal commentedon May 31, 2021
New changeset 7fe9cad by Miss Islington (bot) in branch '3.10':
bpo-44263: Fix _decimal and _testcapi GC protocol (GH-26464) (GH-26465)
7fe9cad
miss-islington commentedon May 31, 2021
New changeset 46b16d0 by Miss Islington (bot) in branch '3.9':
bpo-44263: Fix _decimal and _testcapi GC protocol (GH-26464)
46b16d0
vstinner commentedon Jun 1, 2021
New changeset ee76375 by Victor Stinner in branch 'main':
bpo-44263: Py_TPFLAGS_HAVE_GC requires tp_traverse (GH-26463)
ee76375
vstinner commentedon Jun 1, 2021
I made sure that it's no longer possible to create a type with Py_TPFLAGS_HAVE_GC flag set but with no traverse function (tp_traverse=NULL). I close again the issue.
Fix enum_type_object type on Python 3.11
vstinner commentedon May 2, 2022
Example of bug in the wild: Boost Python enum type defined Py_TPFLAGS_HAVE_GC flag but has no traverse function and instances doesn't have to be tracked by the GC:
Note: it's an enum such an "enum" in C, like a Python int (1, 2, ...). It's unrelated to Python enum module.