[issue27086] Add closefd argument to os.listdir

2021-06-24 Thread Irit Katriel
Irit Katriel added the comment: I agree with Serhiy and David. The responsibility for closing the file is with whoever opened it, and adding an option in a function for it to also close the fd after doing what it was designed to do makes the API unnecessarily over-complicated. -- no

[issue27086] Add closefd argument to os.listdir

2016-05-23 Thread R. David Murray
R. David Murray added the comment: This proposal doesn't feel to me like it matches the general APIs we have in the standard library. I would think the python style for this would be to use a context manager when opening the fd. So, I'm -1 on this proposal. -- nosy: +r.david.murray

[issue27086] Add closefd argument to os.listdir

2016-05-22 Thread Evgeny Kapun
Evgeny Kapun added the comment: Not a problem, just two unnecessary syscalls. Also, I think that many of those who pass a file descriptor to os.listdir don't need it afterwards, because after you fstat() a file descriptor (to discover that it points to a directory) and read the directory conte

[issue27086] Add closefd argument to os.listdir

2016-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the problem with closing a file descriptor after calling os.listdir()? -- nosy: +serhiy.storchaka ___ Python tracker ___ _

[issue27086] Add closefd argument to os.listdir

2016-05-22 Thread Evgeny Kapun
New submission from Evgeny Kapun: Currently, when given a file descriptor, os.listdir will duplicate it so that the original file descriptor is not closed. In many cases, a file descriptor is not needed anymore after directory is listed, so this is not necessary. I propose adding a keyword arg