SIGN IN SIGN UP

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 f1c6ae3270913e095d24ae13ecf96f5a32c8c503)

Co-authored-by: Victor Stinner <vstinner@python.org>

Co-authored-by: Victor Stinner <vstinner@python.org>
M
Miss Islington (bot) committed
acda9f3b90c33e4020237cb9e5c676efb38f7847
Parent: 6111d5d
Committed by GitHub <noreply@github.com> on 1/22/2022, 2:28:36 PM