diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-11-21 11:09:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-21 11:09:40 (GMT) |
commit | d153eb8a1e47123ecdb3fb47995a2c39ce7713ea (patch) | |
tree | d5000f339ad95d098d15ee370b302f00f6d88f0a /Doc/c-api | |
parent | 713b4bbd97392acc492a4fefb2d07ae61fb7b75d (diff) | |
download | cpython-d153eb8a1e47123ecdb3fb47995a2c39ce7713ea.zip cpython-d153eb8a1e47123ecdb3fb47995a2c39ce7713ea.tar.gz cpython-d153eb8a1e47123ecdb3fb47995a2c39ce7713ea.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.
(cherry picked from commit 1db76394ea79030aa4ed5349c950f6c6da51450f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/type.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst index 73f2687..822360e 100644 --- a/Doc/c-api/type.rst +++ b/Doc/c-api/type.rst @@ -155,7 +155,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 @@ -247,7 +248,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. |