MCPcopy Index your code
hub / github.com/python/cpython / find_library

Function find_library

Lib/ctypes/util.py:55–68  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

53 return clibname+'.dll'
54
55 def find_library(name):
56 if name in ('c', 'm'):
57 return find_msvcrt()
58 # See MSDN for the REAL search order.
59 for directory in os.environ['PATH'].split(os.pathsep):
60 fname = os.path.join(directory, name)
61 if os.path.isfile(fname):
62 return fname
63 if fname.lower().endswith(".dll"):
64 continue
65 fname = fname + ".dll"
66 if os.path.isfile(fname):
67 return fname
68 return None
69
70 # Listing loaded DLLs on Windows relies on the following APIs:
71 # https://learn.microsoft.com/windows/win32/api/psapi/nf-psapi-enumprocessmodules

Callers 15

_test_issue18060Method · 0.90
test_openMethod · 0.90
setUpClassMethod · 0.90
setUpClassMethod · 0.90
test_shell_injectionMethod · 0.90
test_find_on_libpathMethod · 0.90
test_gh114257Method · 0.90
test_findMethod · 0.90

Calls 15

find_msvcrtFunction · 0.85
_is_wasmFunction · 0.85
_get_sonameFunction · 0.85
_findLib_gccFunction · 0.85
_findLib_crleFunction · 0.85
_findSoname_ldconfigFunction · 0.85
_findLib_ldFunction · 0.85
escapeMethod · 0.80
splitMethod · 0.45
joinMethod · 0.45
isfileMethod · 0.45
endswithMethod · 0.45

Tested by 15

_test_issue18060Method · 0.72
test_openMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72
test_shell_injectionMethod · 0.72
test_find_on_libpathMethod · 0.72
test_gh114257Method · 0.72
test_findMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…