Bazaar on IronPython
Martin Pool
mbp at sourcefrog.net
Mon Jun 29 08:11:36 BST 2009
2009/6/29 Andrew Bennetts <andrew.bennetts at canonical.com>:
> 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.
I think those are just bugs and we should close them from finally
blocks. Our coding standards (or at least common practice in reviews)
is to insist that people do.
I suppose this means that IronPython will not close files from gc?
--
Martin <http://launchpad.net/~mbp/>
More information about the bazaar
mailing list