]> granicus.if.org Git - python/commitdiff
Fix Issue #4875: find_library can return directories instead of files
authorThomas Heller <theller@ctypes.org>
Tue, 5 May 2009 18:55:47 +0000 (18:55 +0000)
committerThomas Heller <theller@ctypes.org>
Tue, 5 May 2009 18:55:47 +0000 (18:55 +0000)
(on win32)

Lib/ctypes/util.py
Misc/NEWS

index 433d0d9bf660b61e658a2c77a4926797654a8aae..35b0b1e50e9b880375b541745f4be4b87ed2c518 100644 (file)
@@ -52,12 +52,12 @@ if os.name == "nt":
         # See MSDN for the REAL search order.
         for directory in os.environ['PATH'].split(os.pathsep):
             fname = os.path.join(directory, name)
-            if os.path.exists(fname):
+            if os.path.isfile(fname):
                 return fname
             if fname.lower().endswith(".dll"):
                 continue
             fname = fname + ".dll"
-            if os.path.exists(fname):
+            if os.path.isfile(fname):
                 return fname
         return None
 
index d6c6227a876c89efcce001a791b33813b018913b..604c0df48a351e66c49d19cdb0214e4d7c68ee61 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -282,6 +282,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #4875: On win32, ctypes.util.find_library does no longer
+  return directories.
+
 - Issue #5142: Add the ability to skip modules while stepping to pdb.
 
 - Issue #1309567: Fix linecache behavior of stripping subdirectories when