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 pitrou
Recipients alex, amaury.forgeotdarc, benjamin.peterson, brett.cannon, brian.curtin, exarkun, giampaolo.rodola, lemburg, pitrou
Date 2010-10-29.08:22:34
SpamBayes Score 6.1426203e-10
Marked as misclassified No
Message-id <1288340552.3565.17.camel@localhost.localdomain>
In-reply-to <4CCA80C3.5080605@egenix.com>
Content
> That's what I'm referring to: most Python applications are
> written with the fact in mind, that garbage collection will
> close the files or socket.
> 
> That's a perfectly fine way of writing Python applications,

Some people would disagree, especially Windows users who cannot timely
delete files when some file descriptors still point to them.

> so why should the programmer get warned about this regular
> approach to Python programming ?

Again: it is an *optional* warning. It is *disabled* by default, except
when compiled --with-pydebug.

> The same applies for sockets.

It is *definitely* a mistake if the socket has been bound to a local
address and/or connected to a remote endpoint.

> Think of the simple idiom:
> 
> data = open(filename).read()
> 
> This would always create a warning under the proposal.

We have had many Windows buildbot failures because of such coding style.

> If you want to monitor resource usage in your application it
> would be a lot more useful to provide access to the number of
> currently open FDs

Agreed it would be useful as well, but please tell that to operating
system vendors. Python has no way to calculate such a statistic.
History
Date User Action Args
2010-10-29 08:22:36pitrousetrecipients: + pitrou, lemburg, brett.cannon, exarkun, amaury.forgeotdarc, giampaolo.rodola, benjamin.peterson, alex, brian.curtin
2010-10-29 08:22:35pitroulinkissue10093 messages
2010-10-29 08:22:34pitroucreate