@@ -336,7 +336,10 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
336336 dirs.remove('CVS') # don't visit CVS directories
337337
338338 """
339- top = fspath (top )
339+ sys .audit ("os.walk" , top , topdown , onerror , followlinks )
340+ return _walk (fspath (top ), topdown , onerror , followlinks )
341+
342+ def _walk (top , topdown , onerror , followlinks ):
340343 dirs = []
341344 nondirs = []
342345 walk_dirs = []
@@ -410,11 +413,11 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
410413 # the caller can replace the directory entry during the "yield"
411414 # above.
412415 if followlinks or not islink (new_path ):
413- yield from walk (new_path , topdown , onerror , followlinks )
416+ yield from _walk (new_path , topdown , onerror , followlinks )
414417 else :
415418 # Recurse into sub-directories
416419 for new_path in walk_dirs :
417- yield from walk (new_path , topdown , onerror , followlinks )
420+ yield from _walk (new_path , topdown , onerror , followlinks )
418421 # Yield after recursion if going bottom up
419422 yield top , dirs , nondirs
420423
@@ -455,6 +458,7 @@ def fwalk(top=".", topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=
455458 if 'CVS' in dirs:
456459 dirs.remove('CVS') # don't visit CVS directories
457460 """
461+ sys .audit ("os.fwalk" , top , topdown , onerror , follow_symlinks , dir_fd )
458462 if not isinstance (top , int ) or not hasattr (top , '__index__' ):
459463 top = fspath (top )
460464 # Note: To guard against symlink races, we use the standard
0 commit comments