py/parsenum: Fix parsing complex literals with negative real part by dhalbert · Pull Request #10463 · adafruit/circuitpython · GitHub
Skip to content

py/parsenum: Fix parsing complex literals with negative real part#10463

Merged
dhalbert merged 1 commit into
adafruit:mainfrom
dhalbert:complex-parsing-fix
Jul 8, 2025
Merged

py/parsenum: Fix parsing complex literals with negative real part#10463
dhalbert merged 1 commit into
adafruit:mainfrom
dhalbert:complex-parsing-fix

Conversation

@dhalbert

@dhalbert dhalbert commented Jul 8, 2025

Copy link
Copy Markdown
Collaborator

This is the fix from #10297 (thanks @ComplexSymbol) as submitted to MicroPython (2ce63b1) (thanks @jepler) and merged by them. 2ce63b1 was cherry-picked.

So this supersedes #10297.

If a complex literal had a negative real part and a positive imaginary
part, it was not parsed properly because the imaginary part also came out
negative.

Includes a test of complex parsing, which fails without this fix.

Co-authored-by: ComplexSymbol <141301057+ComplexSymbol@users.noreply.github.com>
Signed-off-by: Jeff Epler <jepler@gmail.com>

@jepler jepler left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :)

@dhalbert dhalbert requested a review from FoamyGuy July 8, 2025 18:46

@FoamyGuy FoamyGuy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dhalbert dhalbert merged commit e0e7c82 into adafruit:main Jul 8, 2025
620 checks passed
@dhalbert dhalbert deleted the complex-parsing-fix branch July 8, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants