bpo-46417: Fix race condition on setting type __bases__ (GH-30788) (G… · python/cpython@acda9f3 · GitHub
Skip to content

Commit acda9f3

Browse files
bpo-46417: Fix race condition on setting type __bases__ (GH-30788) (GH-30789)
Fix a race condition on setting a type __bases__ attribute: the internal function add_subclass() now gets the PyTypeObject.tp_subclasses member after calling PyWeakref_NewRef() which can trigger a garbage collection which can indirectly modify PyTypeObject.tp_subclasses. (cherry picked from commit f1c6ae3) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 6111d5d commit acda9f3

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

Lines changed: 5 additions & 0 deletions

Objects/typeobject.c

Lines changed: 16 additions & 11 deletions

0 commit comments

Comments
 (0)