weakrefs and avoiding bad gc cycles

Martin Pool mbp at canonical.com
Wed Jun 1 23:35:56 UTC 2011


On 2 June 2011 03:34, Aaron Bentley <aaron at aaronbentley.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11-05-31 11:48 PM, Martin Pool wrote:
>> On 1 June 2011 13:32, Robert Collins <robertc at robertcollins.net> wrote:
>>> So nothing will leave cycles around indefinitely with *one* exception - __del__.
>>
>> Right, which we pretty much ban: all of them give a warning that you
>> should have explicitly closed the object, except, strangely,
>> SmartMedium (which may be a bug.)
>>
>> Possible we should even get rid of them in non-debug mode.
>
> Yes.  No matter how __del__ is defined, it forces the GC to treat such
> instances much more conservatively.  So in non-debug mode, it's best to
> not even *define* it.

OK, I filed https://bugs.launchpad.net/bzr/+bug/791612 for this.

Martin



More information about the bazaar mailing list