GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Incorrect overflows for complex powers when base is infinite · Issue #156693 · python/cpython

Incorrect overflows for complex powers when base is infinite #156693

New issue
Copy link
New issue
Copy link
Closed
Closed
Incorrect overflows for complex powers when base is infinite#156693
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@skirpichev
skirpichev
opened on Aug 31, 2026
Issue body actions

Bug report

Bug description:

Consider this, for example:

Python 3.16.0a0 (heads/main:ee68f5f46a1, Aug 12 2026, 11:19:39) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> complex('inf+0j')**1
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    complex('inf+0j')**1
    ~~~~~~~~~~~~~~~~~^^~
OverflowError: complex exponentiation

c.f. the real case:

>>> float('inf')**1
inf

See also http://stackoverflow.com/q/18243270/270986

The generic algorithm returns a correct answer (match GNU MPC, for example), but sets errno incorrectly:

>>> import _testcapi
>>> _testcapi._py_c_pow(complex('inf'), 1)
((inf+nanj), 34)
>>> from gmpy2 import mpc
>>> mpc('inf')**1
mpc('inf+nanj')

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

  • gh-156693: correct complex powers with infinite bases #156694

Activity

  1. skirpichev
    self-assigned this
    on Aug 31, 2026
  2. skirpichev
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Aug 31, 2026
  3. skirpichev
    removed their assignment
    on Aug 31, 2026
  4. serhiy-storchaka commented on Sep 3, 2026

    @serhiy-storchaka
    serhiy-storchaka
    on Sep 3, 2026
    Member
    More actions

    complex('inf+0j')**1 was fixed by #124243. Are there other examples?

  5. skirpichev commented on Sep 3, 2026

    @skirpichev
    skirpichev
    on Sep 3, 2026
    MemberAuthor
    More actions

    I think no, my fix was based on #124243.

  6. skirpichev
    closed this as completedon Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.