Skip to content

Failed assertion in codegen_nameop #133516

Closed
@TERESH1

Description

@TERESH1

Crash report

What happened?

>>> compile(source=b'Fal\xc5\xbfe', filename="<test>", mode="exec")
python: Python/codegen.c:3189: int codegen_nameop(compiler *, location, identifier, expr_context_ty): Assertion `!_PyUnicode_EqualToASCIIString(name, "None") && !_PyUnicode_EqualToASCIIString(name, "True") && !_PyUnicode_EqualToASCIIString(name, "False")' failed.
Aborted (core dumped)

The _PyPegen_new_identifier function normalizes to NFKC non-ASCII strings, which allows you to set keywords (None, True, False) with a different character representation as an identifier.

Found by Linux Verification Center (portal.linuxtesting.ru) with libFuzzer
Author S.Tereshin (s.tereshin@fobos-nt.ru)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.14.0a7+ (heads/main-dirty:3dfed2309, May 6 2025, 13:36:58) [Clang 18.1.8 (Fedora 18.1.8-1.fc40)]

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-parsertype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions