From: Serhiy Storchaka Date: Fri, 22 Mar 2024 18:03:48 +0000 (+0200) Subject: gh-117134: Microoptimize glob() for include_hidden=True (GH-117135) X-Git-Tag: v3.13.0a6~181 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a78f6e798d5c2af1dba2df6c9f1f1e5aac02a86;p=thirdparty%2FPython%2Fcpython.git gh-117134: Microoptimize glob() for include_hidden=True (GH-117135) --- diff --git a/Lib/glob.py b/Lib/glob.py index 473502c67336..d59641195a1c 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -104,8 +104,8 @@ def _iglob(pathname, root_dir, dir_fd, recursive, dironly, def _glob1(dirname, pattern, dir_fd, dironly, include_hidden=False): names = _listdir(dirname, dir_fd, dironly) - if include_hidden or not _ishidden(pattern): - names = (x for x in names if include_hidden or not _ishidden(x)) + if not (include_hidden or _ishidden(pattern)): + names = (x for x in names if not _ishidden(x)) return fnmatch.filter(names, pattern) def _glob0(dirname, basename, dir_fd, dironly, include_hidden=False):