X Tutup
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/test/test_ast/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ def test_constant_as_unicode_name(self):
("None", b"N\xc2\xbane"),
]
for constant in constants:
with self.assertRaisesRegex(ValueError,
with self.assertRaisesRegex(SyntaxError,
f"identifier field can't represent '{constant[0]}' constant"):
ast.parse(constant[1], mode="eval")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Raise :exc:`SyntaxError` when constants ``True``, ``False`` or ``None`` are
used as an identifier after NFKC normalization.
2 changes: 1 addition & 1 deletion Parser/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ _PyPegen_new_identifier(Parser *p, const char *n)
};
for (int i = 0; forbidden[i] != NULL; i++) {
if (_PyUnicode_EqualToASCIIString(id, forbidden[i])) {
PyErr_Format(PyExc_ValueError,
RAISE_SYNTAX_ERROR(
"identifier field can't represent '%s' constant",
forbidden[i]);
Py_DECREF(id);
Expand Down
Loading
X Tutup