Question about transaction usage
Douglas Philips
dgou at mac.com
Sun Oct 4 09:25:34 CDT 2009
On or about 2009 Oct 4, at 10:20 AM, Greg Ward indited:
> On Sat, Oct 3, 2009 at 5:36 PM, Matt Mackall <mpm at selenic.com> wrote:
>> Unfortunately, destructors in Python are basically useless. If an
>> exception is thrown, the traceback object will hold references to
>> every
>> stack frame in the call chain, preventing the destructors from
>> getting
>> invoked in a timely fashion (and sometimes at all!).
>>
>> So we make a point of manually destroying locks and transactions.
>
> Got it. Thanks.
> ...
> I think the most useful thing I learned from Java is that you must
> never rely on destructors being called: if your object holds
> resources, give it an explicit close() method. (C)Python destructors
> are more deterministic than Java destructors, but the rule holds.
That's a bit confusing. I haven't looked at the hg source in a while,
but last I did, file objects were not being explicitly closed, and the
attitude seemed to be that destructors/gc would just handle that.
There is some deep asymmetry here or ???
-Doug
More information about the Mercurial-devel
mailing list