Closed
Description
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
- gh-133516: Raise
ValueError
when constantsTrue
,False
orNone
are used as an identifier after NFKC normalization #133523 - [3.14] gh-133516: Raise
ValueError
when constantsTrue
,False
orNone
are used as an identifier after NFKC normalization (GH-133523) #133596 - [3.13] gh-133516: Raise
ValueError
when constantsTrue
,False
orNone
are used as an identifier after NFKC normalization (GH-133523) #133615