Skip to content

Commit fa998ca

Browse files
committed
revert our yield from stdlib patches
1 parent 63ad97e commit fa998ca

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

graalpython/lib-python/3/glob.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,9 @@ def _iglob(pathname, recursive, dironly):
5050
return
5151
if not dirname:
5252
if recursive and _isrecursive(basename):
53-
# yield from _glob2(dirname, basename, dironly)
54-
# TRUFFLE TODO: revert
55-
for __x in _glob2(dirname, basename, dironly): yield __x
53+
yield from _glob2(dirname, basename, dironly)
5654
else:
57-
# yield from _glob1(dirname, basename, dironly)
58-
# TRUFFLE TODO: revert
59-
for __x in _glob1(dirname, basename, dironly): yield __x
55+
yield from _glob1(dirname, basename, dironly)
6056
return
6157
# `os.path.split()` returns the argument itself as a dirname if it is a
6258
# drive or UNC path. Prevent an infinite recursion if a drive or UNC path
@@ -111,9 +107,7 @@ def glob1(dirname, pattern):
111107
def _glob2(dirname, pattern, dironly):
112108
assert _isrecursive(pattern)
113109
yield pattern[:0]
114-
# yield from _rlistdir(dirname, dironly)
115-
# TRUFFLE TODO: revert
116-
for __x in _rlistdir(dirname, dironly): yield __x
110+
yield from _rlistdir(dirname, dironly)
117111

118112
# If dironly is false, yields all file names inside a directory.
119113
# If dironly is true, yields only directory names.

graalpython/lib-python/3/os.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,11 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
406406
# the caller can replace the directory entry during the "yield"
407407
# above.
408408
if followlinks or not islink(new_path):
409-
# TRUFFLE TODO: revert
410-
# yield from walk(new_path, topdown, onerror, followlinks)
411-
for __x, __y, __z in walk(new_path, topdown, onerror, followlinks): yield __x, __y, __z
409+
yield from walk(new_path, topdown, onerror, followlinks)
412410
else:
413411
# Recurse into sub-directories
414412
for new_path in walk_dirs:
415-
# TRUFFLE TODO: revert
416-
# yield from walk(new_path, topdown, onerror, followlinks)
417-
for __x, __y, __z in walk(new_path, topdown, onerror, followlinks): yield __x, __y, __z
413+
yield from walk(new_path, topdown, onerror, followlinks)
418414
# Yield after recursion if going bottom up
419415
yield top, dirs, nondirs
420416

graalpython/lib-python/3/traceback.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -588,17 +588,13 @@ def format(self, *, chain=True):
588588
"""
589589
if chain:
590590
if self.__cause__ is not None:
591-
# TRUFFLE TODO(ls): revert this loop to "yield from"
592-
for __x in self.__cause__.format(chain=chain): yield __x
591+
yield from self.__cause__.format(chain=chain)
593592
yield _cause_message
594593
elif (self.__context__ is not None and
595594
not self.__suppress_context__):
596-
# TRUFFLE TODO(ls): revert this loop to "yield from"
597-
for __x in self.__context__.format(chain=chain): yield __x
595+
yield from self.__context__.format(chain=chain)
598596
yield _context_message
599597
if self.exc_traceback is not None:
600598
yield 'Traceback (most recent call last):\n'
601-
# TODO(ls): revert this loop to "yield from"
602-
for __x in self.stack.format(): yield __x
603-
# TODO(ls): revert this loop to "yield from"
604-
for __x in self.format_exception_only(): yield __x
599+
yield from self.stack.format()
600+
yield from self.format_exception_only()

0 commit comments

Comments
 (0)