[New-bugs-announce] [issue13757] os.fdlistdir() should not close the file descriptor given in argument

Charles-François Natali report at bugs.python.org
Tue Jan 10 19:56:52 CET 2012


New submission from Charles-François Natali <neologix at free.fr>:

os.fdlistdir() closes the FD passed as argument.
This is annoying, since in 99% of the cases you'd like to keep FD intact, so you end up doing os.fdlistdir(os.dup(fd)).
Here's a patch that duplicates the FD in fdlistdir(), so that the original FD is kept intact, which is much more natural (at least to me :).
That's an API change, but since fdlistdir() has been introduced in 3.3 which hasn't been released yet, I think it should be acceptable.

----------
components: Extension Modules
files: fdlistdir_noclose.diff
keywords: patch
messages: 151023
nosy: neologix, pitrou, rosslagerwall
priority: normal
severity: normal
status: open
title: os.fdlistdir() should not close the file descriptor given in argument
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file24194/fdlistdir_noclose.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13757>
_______________________________________


More information about the New-bugs-announce mailing list