summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-11-21 10:02:53 (GMT)
committerGitHub <noreply@github.com>2020-11-21 10:02:53 (GMT)
commit1db76394ea79030aa4ed5349c950f6c6da51450f (patch)
tree1c983ea426540a616afb1dbca1d8c737c3ad63b3 /Doc/c-api
parent01a202ab6b0ded546e47073db6498262086c52e9 (diff)
downloadcpython-1db76394ea79030aa4ed5349c950f6c6da51450f.zip
cpython-1db76394ea79030aa4ed5349c950f6c6da51450f.tar.gz
cpython-1db76394ea79030aa4ed5349c950f6c6da51450f.tar.bz2
bpo-42412: Fix possible leaks and check arguments in PyType_FromModuleAndSpec() (GH-23410)
* There were leaks if Py_tp_bases is used more than once or if some call is failed before setting tp_bases. * There was a crash if the bases argument or the Py_tp_bases slot is not a tuple. * The documentation was not accurate.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/type.rst6
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst
index 84c0a02..a822b67 100644
--- a/Doc/c-api/type.rst
+++ b/Doc/c-api/type.rst
@@ -157,7 +157,8 @@ The following functions and structs are used to create
If *bases* is a tuple, the created heap type contains all types contained
in it as base types.
- If *bases* is ``NULL``, the *Py_tp_base* slot is used instead.
+ If *bases* is ``NULL``, the *Py_tp_bases* slot is used instead.
+ If that also is ``NULL``, the *Py_tp_base* slot is used instead.
If that also is ``NULL``, the new type derives from :class:`object`.
The *module* argument can be used to record the module in which the new
@@ -253,7 +254,8 @@ The following functions and structs are used to create
* :c:member:`~PyBufferProcs.bf_getbuffer`
* :c:member:`~PyBufferProcs.bf_releasebuffer`
- Setting :c:data:`Py_tp_bases` may be problematic on some platforms.
+ Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
+ problematic on some platforms.
To avoid issues, use the *bases* argument of
:py:func:`PyType_FromSpecWithBases` instead.