Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islingtonmiss-islington commented Jan 22, 2022

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

https://bugs.python.org/issue46417

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>
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good bot.

@vstinnervstinner merged commit acda9f3 into python:3.10Jan 22, 2022
@miss-islingtonmiss-islington deleted the backport-f1c6ae3-3.10 branch January 22, 2022 14:28
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@miss-islington@vstinner@the-knights-who-say-ni@bedevere-bot