[issue44698] Undefined behaviour in Objects/complexobject.c's complex_pow

Sebastian Berg report at bugs.python.org
Wed Aug 4 14:21:36 EDT 2021


Sebastian Berg <sebastian at sipsolutions.net> added the comment:

The fix broke NumPy (see also https://github.com/numpy/numpy/pull/19612)

It seems incorrect.  After all, it doesn't matter much whether the float can be converted to an integer correctly (or even if it returns an undefined value), so long `int_value == float_value` remains sensible.

The old cast cast integers to complex when they were out of range (which is fine), the new code raises an error instead.

----------
nosy: +seberg

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44698>
_______________________________________


More information about the Python-bugs-list mailing list