-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed as not planned
Labels
topic-typingtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Crash report
What happened?
This snippet causes a segfault on current main:
import types
lst = []
class X:
def __repr__(self):
lst.clear()
return "x"
lst += [X(), 1]
ga = types.GenericAlias(int, lst)
print(repr(ga))This is because the ga_repr_items_list() function does not properly handle the case where the list is mutated while we're iterating over it.
Similar to #143635 but a distinct code path.
CPython versions tested on:
CPython main branch, 3.14
Operating systems tested on:
macOS
Output from running 'python -VV' on the command line:
Python 3.15.0a4+ (heads/main:1857a40807d, Jan 13 2026, 19:01:52) [Clang 15.0.0 (clang-1500.3.9.4)]
Metadata
Metadata
Assignees
Labels
topic-typingtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump