Uh oh!
There was an error while loading. Please reload this page.
bpo-45440: Require math.h isinf() to build - #28894
Conversation
vstinner
commented
Oct 12, 2021
@mdickinson: In 2021, is it now ok to require a C99 math.h header file? :-) |
vstinner
commented
Oct 12, 2021
Py_FORCE_DOUBLE() is not used in the PyPI top 5000 projects: frozendict-2.0.6.tar.gz contains different copies of pymath.h, but it doesn't call Py_FORCE_DOUBLE(). |
vstinner
commented
Oct 12, 2021
mdickinson
commented
Oct 12, 2021
Yes, provided that MSVC has the functions we need. The practical blocker in the past has been lack of C99 support in MS compilers; other platforms haven't been an issue. |
vstinner
commented
Oct 12, 2021
@mdickinson: Does it mean that you are ok to merge this PR? Can you maybe approve it?
My PR stills still avoids C99 with MSC in pymath.h. It uses MSC specific functions: "Python 3.6 and later can use Microsoft Visual Studio 2017" says https://devguide.python.org/setup/#windows-compiling Maybe we can also use C99 functions on Windows. I didn't try yet. I would prefer to make this change separately to be able to revert it if it causes issues later. |
vstinner
commented
Oct 12, 2021
I'm a little bit worried by this change. That's why I documented it properly. But it's not used in the PyPI top 5000 modules, so it should be fine. We can easily revert this removal if it causes issues. |
mdickinson
commented
Oct 12, 2021
Working right now, but I can do a proper review later today (UTC+1), after work. |
Uh oh!
There was an error while loading. Please reload this page.
vstinner
commented
Oct 13, 2021
@mdickinson: I updated my PR to remove the code specific to Windows (MSC). MSC now uses the same code than GCC/clang, Linux, etc. All platforms now call isinf(), isnan() and isfinite() functions. The code is now even simpler. |
vstinner
commented
Oct 13, 2021
PR rebased to fix a merge conflict. |
Building Python now requires a C99 <math.h> header file providing isinf(), isnan() and isfinite() functions. Remove the Py_FORCE_DOUBLE() macro. It was used by the Py_IS_INFINITY() macro. Changes: * Remove Py_IS_NAN(), Py_IS_INFINITY() and Py_IS_FINITE() in PC/pyconfig.h. * Remove the _Py_force_double() function. * configure no longer checks if math.h defines isinf(), isnan() and isfinite().
vstinner
commented
Oct 13, 2021
I merged my PR. Since the first version of this PR, I made some change to remove MSC specific code. The final change is simpler: just use C99 isinf(), isnan() and isfinite() functions. I now hope that buildbots will like it :-) |
mdickinson
commented
Oct 14, 2021
Sorry; real life got in the way. Thanks for not letting my lack of review block this. I'll take a look post-merge. |
vstinner
commented
Oct 14, 2021
I love post-merge reviews :-) I'm also open to revert if needed. Don't worry. I decided to merge my change to see how it goes with all buildbots. So far, so good. I also like to make such change early during the Python devcycle to have more time to test it before the 3.11.0 final version. So again, we can consider to revert it if needed. It seems like nowadays, it became possible to rely on C99 features like <math.h> isinf() ;-) I'm curious to see if we can remove hypot(), copysign() and round() fallback implementations from Python/pymath.c. |
mdickinson
commented
Oct 15, 2021
That seems like a question that should be easy to answer: the only platform that we care about that might not have full support for C99 is Windows. So if we remove all three of the fallbacks, and the buildbots are still happy for Windows versions back as far as the most ancient version of Windows we still care about (Windows 7?) then we're good. |
mdickinson
commented
Oct 15, 2021
Looks like it's Windows 8.1 for Python >= 3.11. |
vstinner
commented
Oct 15, 2021
Well, let's see ;-) I created: #28977 |
Building Python now requires a C99 <math.h> header file providing
isinf(), isnan() and isfinite() functions.
Remove the Py_FORCE_DOUBLE() macro. It was used by the
Py_IS_INFINITY() macro.
Changes:
in PC/pyconfig.h.
isfinite().
https://bugs.python.org/issue45440