diff options
author | Victor Stinner <vstinner@python.org> | 2023-06-30 10:39:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-30 10:39:55 (GMT) |
commit | 1a2652ceaa55190a0b860abd1448095eafbdf238 (patch) | |
tree | 7de611da949f762a32ccbb1420fd4ba1f33a1796 /Objects | |
parent | 80b3d8f337bef52d7c360b4ee86be873681f747a (diff) | |
download | cpython-1a2652ceaa55190a0b860abd1448095eafbdf238.zip cpython-1a2652ceaa55190a0b860abd1448095eafbdf238.tar.gz cpython-1a2652ceaa55190a0b860abd1448095eafbdf238.tar.bz2 |
Cleanup clear_static_tp_subclasses() (#106276)
Only iterate on the dictionary if Python is built with assertions:
subclass is only needed when Python is built with assertions.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index cc389bc..e67945d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5009,6 +5009,7 @@ clear_static_tp_subclasses(PyTypeObject *type) going to leak. This mostly only affects embedding scenarios. */ +#ifndef NDEBUG // For now we just do a sanity check and then clear tp_subclasses. Py_ssize_t i = 0; PyObject *key, *ref; // borrowed ref @@ -5021,6 +5022,7 @@ clear_static_tp_subclasses(PyTypeObject *type) assert(!(subclass->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN)); Py_DECREF(subclass); } +#endif clear_tp_subclasses(type); } |