Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions Lib/glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re
import fnmatch
import functools
import itertools
import operator
import stat
import sys
Expand Down Expand Up @@ -52,13 +51,10 @@ def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False,
it = _iglob(pathname, root_dir, dir_fd, recursive, False,
include_hidden=include_hidden)
if not pathname or recursive and _isrecursive(pathname[:2]):
try:
s = next(it) # skip empty string
if s:
it = itertools.chain((s,), it)
except StopIteration:
pass
return it
peek = next(it, sentinel := object())
if peek and peek is not sentinel:
yield peek
yield from it

def _iglob(pathname, root_dir, dir_fd, recursive, dironly,
include_hidden=False):
Expand Down
Loading