aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-11-11 14:27:32 +0100
committerGitHub <noreply@github.com>2020-11-11 14:27:32 +0100
commitba2958ed40d284228836735cbed4a155190e0998 (patch)
tree8266560eea9bd2d980e9f19196703d0dfcfb8513 /Include/cpython
parentbpo-40932: Note security caveat of shlex.quote on Windows (GH-21502) (diff)
downloadcpython-ba2958ed40d284228836735cbed4a155190e0998.tar.gz
cpython-ba2958ed40d284228836735cbed4a155190e0998.tar.bz2
cpython-ba2958ed40d284228836735cbed4a155190e0998.zip
bpo-40170: Fix PyType_Ready() refleak on static type (GH-23236)
bpo-1635741, bpo-40170: When called on a static type with NULL tp_base, PyType_Ready() no longer increments the reference count of the PyBaseObject_Type ("object). PyTypeObject.tp_base is a strong reference on a heap type, but it is borrowed reference on a static type. Fix 99 reference leaks at Python exit (showrefcount 18623 => 18524).
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/object.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index ec6a3647677..43b0be37557 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -244,6 +244,7 @@ struct _typeobject {
struct PyMethodDef *tp_methods;
struct PyMemberDef *tp_members;
struct PyGetSetDef *tp_getset;
+ // Strong reference on a heap type, borrowed reference on a static type
struct _typeobject *tp_base;
PyObject *tp_dict;
descrgetfunc tp_descr_get;