`os.walk()` silently produces an empty iterator if the argument is not a path to directory: ```pycon >>> import os >>> list(os.walk('./non-existing')) [] >>> list(os.walk('./python')) [] >>> list(os.walk('/dev/null')) [] ``` It can causes bugs like #99203, when a function produces some incorrect result instead of raising an exception. <!-- gh-linked-prs --> ### Linked PRs * gh-151734 <!-- /gh-linked-prs -->
os.walk()silently produces an empty iterator if the argument is not a path to directory:It can causes bugs like #99203, when a function produces some incorrect result instead of raising an exception.
Linked PRs
os.walk()andos.fwalk()raiseNotADirectoryErrorfor non-directory top #151734