Skip to content

Commit 5901b8d

Browse files
jeplerdpgeorge
authored andcommitted
tests/cpydiff: Document complex() parsing difference.
In micropython#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>
1 parent 841acb9 commit 5901b8d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/cpydiff/types_complex_parser.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
categories: Types,complex
3+
description: MicroPython's complex() accepts certain incorrect values that CPython rejects
4+
cause: MicroPython is highly optimized for memory usage.
5+
workaround: Do not use non-standard complex literals as argument to complex()
6+
7+
MicroPython's ``complex()`` function accepts literals that contain a space and
8+
no sign between the real and imaginary parts, and interprets it as a plus.
9+
"""
10+
11+
try:
12+
print(complex("1 1j"))
13+
except ValueError:
14+
print("ValueError")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy