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 serhiy.storchaka
Recipients Arfrever, hynek, larry, serhiy.storchaka
Date 2012-06-29.05:58:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340949524.2515.9.camel@raxxla>
In-reply-to <1340913826.46.0.696601959866.issue15217@psf.upfronthosting.co.za>
Content
> 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.
History
Date User Action Args
2012-06-29 05:58:23serhiy.storchakasetrecipients: + serhiy.storchaka, larry, Arfrever, hynek
2012-06-29 05:58:22serhiy.storchakalinkissue15217 messages
2012-06-29 05:58:22serhiy.storchakacreate