Skip to content

Commit

Permalink
pythongh-117134: Microoptimize glob() for include_hidden=True (python…
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Mar 22, 2024
1 parent 00baaa2 commit 5a78f6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 5a78f6e

Please sign in to comment.