From 6f2017076293f0e1ea807260434053a58be6667b Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 12 Aug 2014 12:55:12 +0300 Subject: [PATCH] Issue #17923: glob() patterns ending with a slash no longer match non-dirs on AIX. Based on patch by Delhallt. --- Lib/glob.py | 11 ++++++++--- Misc/NEWS | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Lib/glob.py b/Lib/glob.py index e388b5f9c0..d6eca248eb 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 diff --git a/Misc/NEWS b/Misc/NEWS index b993e96ab1..45bbe6be09 100644 --- 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. -- 2.40.0