You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make PyComplex_RealAsDouble/ImagAsDouble use __complex__ #109598
So, we assume instead that the op is a float-like class (a subtype of or something with a __float__ dunder method). Instead, we should look on the __complex__ method in the else branch. This is an issue like #44670, I think.
Minor issue: these functions aren't tested, only indirectly with format() (that will not trigger all possible cases).
Edit:
The current PyComplex_ImagAsDouble() silently returns 0.0 for all non-PyComplexObject objects (or subtypes of). I think it's a bug and we should return -1.0 instead and set the error indicator.
Activity
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
skirpichev commentedon Nov 5, 2023
PR is ready for review: #109647
gh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __complex__ (G…
encukou commentedon Jan 15, 2024
Thanks for the PR!
I don't think this is bugfix-y enough to need backporting.
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…
pythongh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __compl…