]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17923: glob() patterns ending with a slash no longer match non-dirs on
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 12 Aug 2014 09:55:12 +0000 (12:55 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 12 Aug 2014 09:55:12 +0000 (12:55 +0300)
AIX.  Based on patch by Delhallt.

Lib/glob.py
Misc/NEWS

index e388b5f9c0dd0e6bca9839cfb912e3aa4023b1af..d6eca248eb74efe05e82cf4d689f4ca81e400fed 100644 (file)
@@ -26,11 +26,16 @@ def iglob(pathname):
     patterns.
 
     """
+    dirname, basename = os.path.split(pathname)
     if not has_magic(pathname):
-        if os.path.lexists(pathname):
-            yield pathname
+        if basename:
+            if os.path.lexists(pathname):
+                yield pathname
+        else:
+            # Patterns ending with a slash should match only directories
+            if os.path.isdir(dirname):
+                yield pathname
         return
-    dirname, basename = os.path.split(pathname)
     if not dirname:
         yield from glob1(None, basename)
         return
index b993e96ab1741b23dfd632b950943101b4699dc7..45bbe6be09e4f6818a991770a9fb6d0837140a34 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -27,6 +27,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #17923: glob() patterns ending with a slash no longer match non-dirs on
+  AIX.  Based on patch by Delhallt.
+
 - Issue #21121: Don't force 3rd party C extensions to be built with
   -Werror=declaration-after-statement.