[Python-3000] close() on open(fd, closefd=False)

Benjamin Peterson musiccomposition at gmail.com
Fri Oct 31 23:02:47 CET 2008


On Fri, Oct 31, 2008 at 4:50 PM, Christian Heimes <lists at cheimes.de> wrote:
> Amaury has found an issue with open and closefd,
> http://bugs.python.org/issue4233
>
> The additional warnings aren't critical. But in retrospection I think that I
> made a small error during the design of the closefd feature.
> With a file descriptor number as first argument and closefd set to false,
> the file descriptor isn't closed when the file object is deallocated. It's
> also impossible to close the fd with close(). Right now close() doesn't do
> anything and you can still write or read after close(). This behavior is
> surprising to the user. I like to change close() to set the internal fd
> attribute to -1 (meaning close) but keep the fd open.

Isn't it too late to make semantic changes like this? Not only is 3.0
in rc phase, but we've release 2.6's io backport with this
(mis)feature.

>
> Maybe the warning could be dropped all along, too.

That may be the best course of action.



-- 
Cheers,
Benjamin Peterson
"There's nothing quite as beautiful as an oboe... except a chicken
stuck in a vacuum cleaner."


More information about the Python-3000 mailing list