]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-99249: Clarify "read-only" slots tp_bases & tp_mro (GH-99342)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 28 Nov 2022 11:26:05 +0000 (03:26 -0800)
committerGitHub <noreply@github.com>
Mon, 28 Nov 2022 11:26:05 +0000 (03:26 -0800)
commitb1c148c1be73bcd65350e2fc7833db773a08b798
treec841acd7adc060ee63c6abf155b790c4e9350633
parent345aaa41766d5ec2e34cf08beb79307caf5fc5cf
gh-99249: Clarify "read-only" slots tp_bases & tp_mro (GH-99342)

These slots are marked "should be treated as read-only" in the
table at the start of the document.  That doesn't say anything about
setting them in the static struct.

`tp_bases` docs did say that it should be ``NULL`` (TIL!). If you
ignore that, seemingly nothing bad happens. However, some slots
may not be inherited, depending on which sub-slot structs are present.
(FWIW, NumPy sets tp_bases and is affected by the quirk -- though to
be fair, its DUAL_INHERIT code probably predates tp_bases docs, and
also the result happens to be benign.)

This patch makes things explicit.
It also makes the summary table legend easier to scan.

(cherry picked from commit 219696abb240607d3f807853c4c180825e60716e)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Doc/c-api/typeobj.rst