edge case when parsing complex numbers · Issue #105027 · python/cpython (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@mattip

Description

@mattip

Bug report

A clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.

Parsing -1.0j with no real part will assume the real part is -0, not +0. This is a change from Python2. Is it intentional? PyPy3 will assume +0. This is the root cause of this PyPy issue

$ python3.11
Python 3.11.3 (main, Apr  5 2023, 14:14:37) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> -1.0j
(-0-1j)
>>> 0-1.0j
-1j
>>> 

Your environment

Debian-provided python3 all do this (python3.9, python3.10, python3.11).