import ast
m = ast.Module(
body=[
ast.Expr(
value=ast.ListComp(
elt=ast.NamedExpr(
target=ast.Constant(value=1),
value=ast.Constant(value=3),
),
generators=[
ast.comprehension(
target=ast.Name(id="x", ctx=ast.Store()),
iter=ast.Name(id="y", ctx=ast.Load()),
ifs=[],
is_async=0,
)
],
)
)
],
type_ignores=[],
)
compile(ast.fix_missing_locations(m), "<file>", "exec")
% ./python.exe namedexpr.py
Assertion failed: (e->kind == Name_kind), function symtable_extend_namedexpr_scope, file symtable.c, line 1877.
zsh: abort ./python.exe namedexpr.py
This is on a debug build; on a release build presumably it will segfault or trigger UB somewhere.
I'll have a fix soon.