Introspection test: Reverse os.add_dll_directory() order

It looks like os.add_dll_directory() works in a LIFO order, so we call
os.add_dll_directory() from the end of the list of directories in %PATH%
so that the directories are searched in the correct order.
This commit is contained in:
Chun-wei Fan 2022-04-26 11:19:16 +08:00
parent 3471c22f52
commit 65a7df47f2

View File

@ -9,7 +9,7 @@ import sys
# be loaded successfully by Python. Make things easiler for people
# by calling os.add_dll_directory() on the valid paths in %PATH%.
if hasattr(os, 'add_dll_directory'):
paths = os.environ['PATH'].split(os.pathsep)
paths = reversed(os.environ['PATH'].split(os.pathsep))
for path in paths:
if path != '' and os.path.isdir(path):
os.add_dll_directory(path)