Message164314
| 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. |
|