Skip to content

[3.15] gh-160840: In PyType_GetModuleByToken, fall back to tp_bases if tp_mro is gone (GH-162160) - #162755

Merged
encukou merged 1 commit into
python:3.15from
miss-islington:backport-4499a94-3.15
Nov 30, 2026
Merged

encukou merged 1 commit into
python:3.15from
miss-islington:backport-4499a94-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

PyType_GetModuleByToken asserted that a type's mro is not NULL,
but this can happen when cleaning a GC cycle. If it does, we can
still fall back to walking tp_bases.
(cherry picked from commit 4499a94)

Co-authored-by: Petr Viktorin encukou@gmail.com

… tp_mro is gone (pythonGH-162160)

`PyType_GetModuleByToken` asserted that a type's `mro` is not NULL,
but this can happen when cleaning a GC cycle. If it does, we can
still fall back to walking `tp_bases`.
(cherry picked from commit 4499a94)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@encukou
encukou merged commit a5882c6 into python:3.15 Nov 30, 2026
56 checks passed
@miss-islington
miss-islington deleted the backport-4499a94-3.15 branch November 30, 2026 15:01
Sign up for free to 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.

2 participants