Skip to content

Commit 5a78f6e

Browse files
gh-117134: Microoptimize glob() for include_hidden=True (GH-117135)
1 parent 00baaa2 commit 5a78f6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/glob.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ def _iglob(pathname, root_dir, dir_fd, recursive, dironly,
104104

105105
def _glob1(dirname, pattern, dir_fd, dironly, include_hidden=False):
106106
names = _listdir(dirname, dir_fd, dironly)
107-
if include_hidden or not _ishidden(pattern):
108-
names = (x for x in names if include_hidden or not _ishidden(x))
107+
if not (include_hidden or _ishidden(pattern)):
108+
names = (x for x in names if not _ishidden(x))
109109
return fnmatch.filter(names, pattern)
110110

111111
def _glob0(dirname, basename, dir_fd, dironly, include_hidden=False):

0 commit comments

Comments
 (0)