tests/cpydiff: Explain the numeric literal parsing difference.
Fixes issue #17224. Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
committed by
Damien George
parent
44bcfe53de
commit
e22c666d06
@@ -1,8 +1,15 @@
|
|||||||
"""
|
"""
|
||||||
categories: Syntax,Spaces
|
categories: Syntax,Spaces
|
||||||
description: uPy requires spaces between literal numbers and keywords, CPy doesn't
|
description: MicroPython requires spaces between literal numbers and keywords, CPython doesn't
|
||||||
cause: Unknown
|
cause: Different parser implementation
|
||||||
workaround: Unknown
|
|
||||||
|
MicroPython's tokenizer treats a sequence like ``1and`` as a single token, while CPython treats it as two tokens.
|
||||||
|
|
||||||
|
Since CPython 3.11, this syntax causes a ``SyntaxWarning`` for an "invalid literal".
|
||||||
|
|
||||||
|
workaround: Add a space between the integer literal and the intended next token.
|
||||||
|
|
||||||
|
This also fixes the ``SyntaxWarning`` in CPython.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user