Other _Py_* helpers in the complexobject.c - only set errno on errors, assuming that it was set to 0 prior to the function call. This is not the case for _Py_c_abs().
So, it's possible to trigger OverflowError in abs() for nan's input:
$ cat a.py
import _testcapi
z = complex('nan')
_testcapi.set_errno(34)
abs(z)
$ ./python a.py
Traceback (most recent call last):
File "/home/sk/src/cpython/a.py", line 4, in <module>
abs(z)
~~~^^^
OverflowError: absolute value too large
Activity
gh-155526: Don't check errno in abs(complex) (#155527)
[3.15] pythongh-155526: Don't check errno in abs(complex) (pythonGH-1…
pythongh-155526: Don't check errno in abs(complex) (python#155527)
pythongh-155526: Don't check errno in abs(complex) (python#155527)
[3.15] gh-155526: Don't check errno in abs(complex) (GH-155527) (#157341
[3.14] gh-155526: Don't check errno in abs(complex) (GH-155527) (GH-1…
[3.13] gh-155526: Don't check errno in abs(complex) (GH-155527) (#157341