From: Serhiy Storchaka Date: Tue, 12 Aug 2014 09:54:55 +0000 (+0300) Subject: Issue #17923: glob() patterns ending with a slash no longer match non-dirs on X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3fdffc9fb69b8c2893c833c494132b00c26f5e8f;p=python 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 f34534b53c..b3d9ec1b1f 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -35,11 +35,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: for name in glob1(os.curdir, basename): yield name diff --git a/Misc/NEWS b/Misc/NEWS index 222d928c3a..fc8826936d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,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 #21975: Fixed crash when using uninitialized sqlite3.Row (in particular when unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the __new__() method.