summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2025-05-09 19:17:50 +0200
committerDamien George <damien@micropython.org>2025-05-16 11:45:18 +1000
commite22c666d0623e6273d748f787a84d3108a57f1c3 (patch)
treeb623cbd7b0d46d8aa5d9bc3751d103e237194ede
parent44bcfe53de6fdc1f3eb0f104798f5679d7b4473d (diff)
tests/cpydiff: Explain the numeric literal parsing difference.
Fixes issue #17224. Signed-off-by: Jeff Epler <jepler@gmail.com>
-rw-r--r--tests/cpydiff/syntax_spaces.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/cpydiff/syntax_spaces.py b/tests/cpydiff/syntax_spaces.py
index 03d25d561..86faa5981 100644
--- a/tests/cpydiff/syntax_spaces.py
+++ b/tests/cpydiff/syntax_spaces.py
@@ -1,8 +1,15 @@
"""
categories: Syntax,Spaces
-description: uPy requires spaces between literal numbers and keywords, CPy doesn't
-cause: Unknown
-workaround: Unknown
+description: MicroPython requires spaces between literal numbers and keywords, CPython doesn't
+cause: Different parser implementation
+
+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: