summaryrefslogtreecommitdiffstats
path: root/Lib/glob.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-08-12 09:55:12 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-08-12 09:55:12 (GMT)
commit6f2017076293f0e1ea807260434053a58be6667b (patch)
tree2d3003a04fd0460556cb7cb1195aa7381130cb39 /Lib/glob.py
parentc04d468333290e42913449f402d5110d556afe8a (diff)
downloadcpython-6f2017076293f0e1ea807260434053a58be6667b.zip
cpython-6f2017076293f0e1ea807260434053a58be6667b.tar.gz
cpython-6f2017076293f0e1ea807260434053a58be6667b.tar.bz2
Issue #17923: glob() patterns ending with a slash no longer match non-dirs on
AIX. Based on patch by Delhallt.
Diffstat (limited to 'Lib/glob.py')
-rw-r--r--Lib/glob.py11
1 files changed, 8 insertions, 3 deletions
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 @@ 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