Serhiy Storchaka <storch...@gmail.com> added the comment:

> I proposed making os.listdir accept dir_fd, and internally use open and 
> listdir to emulate the behavior.

Hmm, I understood the issue as the request for adding dir_fd argument to
os.listdir. openat+fdopendir+readdir+closedir+close or, in Python,

def listdir2(path, dir_fd=None):
    fd = os.open(path, dir_fd)
    try:
        return os.listdir(fd)
    finally:
        os.close(fd)

>   But someone (Antoine?) rightly pointed out, this would break the guideline 
> that POSIX os.* functions on Unix-y OSes are atomic.

os.listdir is not atomic. opendir+readdir+closedir+close or fdup
+fdopendir+readdir+closedir+close.

----------

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

Reply via email to