threading support in python

Paul Rubin http
Wed Sep 6 16:29:33 EDT 2006


"sjdevnull at yahoo.com" <sjdevnull at yahoo.com> writes:
> > We had that debate already (PEP 343).  Yes, there is some sloppy
> > current practice by CPython users that relies on the GC to close the
> > db conn.
> 
> This point is unrelated to with or ref-counting.  Even the standard
> library will close file objects when they are GC'd.

I don't think so.  AFAIK, there is no such thing as "when they are
GC'd" in the language spec.  There is, at best, "if they are GC'd",
not "when".  You are not guaranteed that GC ever takes place.  At
best, those destructors run when the application totally shuts down,
as the process is about to exit, but I'm not sure whether the spec
promises even that.

> If this is not acceptable, it's a major change; 

It is guaranteeing GC running at any particular time that would be a
major change.  There is no such guarantee right now; there is just an
implementation artifact in CPython that has led to careless habits
among some users.



More information about the Python-list mailing list