tests/cpydiff: Document complex() parsing difference.
In #17384 it was decided that fixing this difference was not worth the code size increase. So document it instead. Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
committed by
Damien George
parent
841acb9df1
commit
5901b8d149
14
tests/cpydiff/types_complex_parser.py
Normal file
14
tests/cpydiff/types_complex_parser.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
"""
|
||||||
|
categories: Types,complex
|
||||||
|
description: MicroPython's complex() accepts certain incorrect values that CPython rejects
|
||||||
|
cause: MicroPython is highly optimized for memory usage.
|
||||||
|
workaround: Do not use non-standard complex literals as argument to complex()
|
||||||
|
|
||||||
|
MicroPython's ``complex()`` function accepts literals that contain a space and
|
||||||
|
no sign between the real and imaginary parts, and interprets it as a plus.
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
print(complex("1 1j"))
|
||||||
|
except ValueError:
|
||||||
|
print("ValueError")
|
||||||
Reference in New Issue
Block a user