From 13ea46855ae2a058fa6095a212f8bb7919a9f3a6 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Thu, 29 Oct 2020 18:01:43 -0600 Subject: [PATCH] MAINT: Add check for Windows 10 version 2004 bug. Warn when the OS shows the fmod bug. --- numpy/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/numpy/__init__.py b/numpy/__init__.py index 70c336106c4..c3cdd6950aa 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -286,6 +286,26 @@ def _mac_os_check(): raise RuntimeError(msg) del _mac_os_check + def _win_os_check(): + """ + Quick Sanity check for Windows OS: look for fmod bug issue 16744. + """ + try: + a = arange(13 * 13, dtype= float64).reshape(13, 13) + a = a % 17 # calls fmod + linalg.eig(a) + except Exception: + msg = ("The current Numpy installation ({!r}) fails to " + "pass a sanity check due to a bug in the windows runtime. " + "See this issue for more information: " + "https://tinyurl.com/y3dm3h86") + raise RuntimeError(msg.format(__file__)) from None + + if sys.platform == "win32" and sys.maxsize > 2**32: + _win_os_check() + + del _win_os_check + # We usually use madvise hugepages support, but on some old kernels it # is slow and thus better avoided. # Specifically kernel version 4.6 had a bug fix which probably fixed this: