Ronald Oussoren <ronaldousso...@mac.com> added the comment:

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 pathlib.py

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33635>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to