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

Commit f1c6ae3

Browse files
authored
bpo-46417: Fix race condition on setting type __bases__ (GH-30788)
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.
1 parent c8a5366 commit f1c6ae3

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)