gh-155526: correct errno handling in complex_abs() - #155527
Conversation
|
CC @vstinner |
|
This breaks >>> import cmath
>>> cmath.polar(complex(1e300, 1e-320))
Traceback (most recent call last):
...
OverflowError: math range error
|
|
@serhiy-storchaka, are you suggesting (1) reversion of |
Documentation build overview
8 files changed ·
|
|
Just FYI, GH code search has no hits for |
vstinner
left a comment
There was a problem hiding this comment.
The change mostly LGTM. I just have a last request about the change documentation.
I understand that this change fix a bug in math.isnan() if errno is non-zero. Would it make sense to backport the fix to 3.13-3.15 branches, without the C API change?
Co-authored-by: hpkfft.com <paul@hpkfft.com>
Co-authored-by: hpkfft.com <paul@hpkfft.com>
|
I applied the 2 @hpkfft's suggestions (fixing typos). |
It fixes
Looks to be a very minor issue. Though, I can revert all C-API changes for a separate PR. |
Oh no, there is no need to revert C API changes in this PR. |
Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the updated PR. Errno is now tested by all C _Py_c_abs() tests. There is also a test on Python abs() setting/checking errno. The changes are now well documented in Changelog entries and in the documentation. Good!
|
Merged, thanks for the fix, and sorry for being picky on documenting the change :-D @skirpichev: So what do you think of backporting the fix to Python 3.15 and older without changing _Py_c_abs() API? |
|
For the backport, I suppose that we can do simply what the issue title says: "complex_abs() should call _Py_c_abs() with errno=0 set": just set errno to 0 before calling _Py_c_abs(). |
Uh oh!
There was an error while loading. Please reload this page.