Issue #17923: glob() patterns ending with a slash no longer match non-dirs on
AIX. Based on patch by Delhallt.
diff --git a/Lib/glob.py b/Lib/glob.py
index e388b5f..d6eca24 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -26,11 +26,16 @@
patterns.
"""
- if not has_magic(pathname):
- if os.path.lexists(pathname):
- yield pathname
- return
dirname, basename = os.path.split(pathname)
+ if not has_magic(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
if not dirname:
yield from glob1(None, basename)
return