New submission from STINNER Victor <vstin...@redhat.com>:
Just after calling _PyRuntime_Initialize(), Py_Main() calls: /* 754 requires that FP exceptions run in "no stop" mode by default, * and until C vendors implement C99's ways to control FP exceptions, * Python requires non-stop mode. Alas, some platforms enable FP * exceptions by default. Here we disable them. */ #ifdef __FreeBSD__ fedisableexcept(FE_OVERFLOW); #endif It's done before calling Py_Initialize(). So applications embedding Python don't call it. But "customized Python" which call the new Py_RunMain() with Py_InititializeFromConfig() will not call it neither. I would like to know if this setup code should be moved into Py_Initialize()? Especially into the new PyConfig API: https://docs.python.org/dev/c-api/init_config.html PyConfig got 2 flags to control parameters which affect the whole process: * configure_c_stdio * configure_locale What is the behavior on FreeBSD when fedisableexcept(FE_OVERFLOW) is not called? Note: I'm not sure why this call is only needed on FreeBSD, but not on macOS, OpenBSD or NetBSD (operating systems close to FreeBSD). ---------- components: Interpreter Core messages: 347048 nosy: lemburg, mark.dickinson, stutzbach, vstinner priority: normal severity: normal status: open title: Should Py_Initialize() control the floating point mode? versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37474> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com