summarylogtreecommitdiffstats
path: root/0105-ctypes-find_library-c-should-return-None-with-ucrt.patch
diff options
context:
space:
mode:
Diffstat (limited to '0105-ctypes-find_library-c-should-return-None-with-ucrt.patch')
-rw-r--r--0105-ctypes-find_library-c-should-return-None-with-ucrt.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/0105-ctypes-find_library-c-should-return-None-with-ucrt.patch b/0105-ctypes-find_library-c-should-return-None-with-ucrt.patch
new file mode 100644
index 000000000000..1352c0210ada
--- /dev/null
+++ b/0105-ctypes-find_library-c-should-return-None-with-ucrt.patch
@@ -0,0 +1,41 @@
+From bf97e2d2da502effd0116a00d4a02a69b7a9c2a9 Mon Sep 17 00:00:00 2001
+From: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri, 23 Jul 2021 18:23:58 +0200
+Subject: [PATCH 105/N] ctypes: find_library('c') should return None with
+ ucrt
+
+Just like with MSVC. This fixes a test in test_ctypes.
+---
+ Lib/ctypes/util.py | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
+index 0c2510e..48ddb3b 100644
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -31,6 +31,12 @@ if os.name == "nt":
+ # else we don't know what version of the compiler this is
+ return None
+
++ def find_msvcrt_mingw():
++ is_ucrt = 'clang' in sys.version.lower() or 'ucrt' in sys.version.lower()
++ if is_ucrt:
++ return None
++ return 'msvcrt.dll'
++
+ def find_msvcrt():
+ """Return the name of the VC runtime dll"""
+ version = _get_build_version()
+@@ -54,6 +60,9 @@ if os.name == "nt":
+
+ def find_library(name):
+ if name in ('c', 'm'):
++ import sysconfig
++ if sysconfig.get_platform().startswith('mingw'):
++ return find_msvcrt_mingw()
+ return find_msvcrt()
+ # See MSDN for the REAL search order.
+ for directory in os.environ['PATH'].split(os.pathsep):
+--
+2.33.0
+