diff options
| author | Jeff Epler <jepler@gmail.com> | 2025-06-10 08:21:14 +0200 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-06-16 23:34:34 +1000 |
| commit | 5901b8d149d63d74354bfb3f7f44a0b942eda23e (patch) | |
| tree | dd6773d3969c0ee212d382a3d66597be88083f0c | |
| parent | 841acb9df1eba53b1d6daf0684eddec17680235c (diff) | |
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>
| -rw-r--r-- | tests/cpydiff/types_complex_parser.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/cpydiff/types_complex_parser.py b/tests/cpydiff/types_complex_parser.py new file mode 100644 index 000000000..4a012987d --- /dev/null +++ b/tests/cpydiff/types_complex_parser.py @@ -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") |
