Skip to content

edge case when parsing complex numbers #105027

Closed as not planned
Closed as not planned
@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).

  • CPython versions tested on:
  • Operating system and architecture:
    Debian, CPython 3.9, 3.10, 3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions