Skip to content

Commit

Permalink
ctypes: find_library('c') should return None with ucrt
Browse files Browse the repository at this point in the history
Just like with MSVC. This fixes a test in test_ctypes.
  • Loading branch information
lazka committed Aug 25, 2023
1 parent e178448 commit bc92836
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lib/ctypes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def _get_build_version():
# 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()
Expand All @@ -54,6 +60,9 @@ def find_msvcrt():

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):
Expand Down

0 comments on commit bc92836

Please sign in to comment.