Bazaar on IronPython

Andrew Bennetts andrew.bennetts at canonical.com
Mon Jun 29 03:10:50 BST 2009


Martin Pool wrote:
[...]
> > Using ref-counted RAII is convenient. To change everything to
> > finally-close would be too much pain for no actual benefit.
> 
> Well, I agree it's more convenient, but I don't think it's a good
> tradeoff.  The problems with running code from __del__ are: exceptions
> raised there are lost, you don't know when precisely it will run, it
> may not run at all before the process exits, because of the preceding
> points it's hard to test, it may impede garbage collection, and
> perhaps more.  The net effect is that you cannot use it for anything
> that really has to be done, like releasing a lock.  Just about the
> only thing we use it for at the moment is giving a warning that the
> object was not closed, and I think even that is questionable.  (See
> https://bugs.edge.launchpad.net/bzr/+bug/391024)

And, judging from the patch, we sometimes open files (like config files)
without explicitly closing them, relying on garbage collection to do it.

-Andrew.




More information about the bazaar mailing list