Pinging @storchaka @tim.one @skirpichev: is it worth opening a GitHub issue for the idea of removing CPython’s dependence on errno here? It would be nice to free the code from reliance on “global” (really thread-local) state for what should be a pure function, for all sorts of reasons - easier to reason about, opportunities for optimization, etc.
float_pow in particular seems unnecessarily evil in that it’s not just reading that global state, but also writing to it (code ref) to force overflow exceptions, so even on boxes whose libm doesn’t touch errno (e.g., macOS), correct operation still relies on writes and reads of errno.
Getting rid of the errno dependence wasn’t really an option before we assumed IEEE 754 for CPython, but I believe it’s now reasonable.
I don’t have resources to work on this myself, so I don’t want to spam the issue tracker unless there’s interest from others. But if there is interest, I’ll happily open that issue.