>>> 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)
Python 3.14.0a7+ (heads/main-dirty:3dfed2309, May 6 2025, 13:36:58) [Clang 18.1.8 (Fedora 18.1.8-1.fc40)]
Crash report
What happened?
The
_PyPegen_new_identifierfunction 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
ValueErrorwhen constantsTrue,FalseorNoneare used as an identifier after NFKC normalization #133523ValueErrorwhen constantsTrue,FalseorNoneare used as an identifier after NFKC normalization (GH-133523) #133596ValueErrorwhen constantsTrue,FalseorNoneare used as an identifier after NFKC normalization (GH-133523) #133615