This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients Victor Domingos, ned.deily, ronaldoussoren
Date 2018-05-27.11:17:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This is fairly odd behaviour of macOS, the same error can be seen from a bash session:

$ stat /dev/fd/3
stat: /dev/fd/3: stat: Bad file descriptor

The reason os.walk() works while the Path().is_file doesn't is that os.walk() explicitly guards against OSError exceptions raised by os.stat(). 

Looking at the documentation this could be seen as a bug in macOS, as the manual page for stat(2) doesn't mention EBADF as a valid error for this system call.  

I'm not sure at this point if we should add a workaround for this. An actual patch would be easy enough, "just" add EBADF to the list of ignored errno values in the implementation of is_file (and related method) in
Date User Action Args
2018-05-27 11:17:24ronaldoussorensetrecipients: + ronaldoussoren, ned.deily, Victor Domingos
2018-05-27 11:17:24ronaldoussorensetmessageid: <>
2018-05-27 11:17:24ronaldoussorenlinkissue33635 messages
2018-05-27 11:17:24ronaldoussorencreate