Skip to content

Commit bc92836

Browse files
committed
ctypes: find_library('c') should return None with ucrt
Just like with MSVC. This fixes a test in test_ctypes.
1 parent e178448 commit bc92836

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/ctypes/util.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ def _get_build_version():
3131
# else we don't know what version of the compiler this is
3232
return None
3333

34+
def find_msvcrt_mingw():
35+
is_ucrt = 'clang' in sys.version.lower() or 'ucrt' in sys.version.lower()
36+
if is_ucrt:
37+
return None
38+
return 'msvcrt.dll'
39+
3440
def find_msvcrt():
3541
"""Return the name of the VC runtime dll"""
3642
version = _get_build_version()
@@ -54,6 +60,9 @@ def find_msvcrt():
5460

5561
def find_library(name):
5662
if name in ('c', 'm'):
63+
import sysconfig
64+
if sysconfig.get_platform().startswith('mingw'):
65+
return find_msvcrt_mingw()
5766
return find_msvcrt()
5867
# See MSDN for the REAL search order.
5968
for directory in os.environ['PATH'].split(os.pathsep):

0 commit comments

Comments
 (0)