[MERGE] Discard most of TestCase instances __dict__ after successful tests to reduce memory consumption

John Arbash Meinel john at arbash-meinel.com
Tue Feb 19 15:15:39 GMT 2008

John Arbash Meinel has voted tweak.
Status is now: Conditionally approved
This seems a very odd idiom:
+        if getattr(test, '_log_contents', '') != '':
+            del test._log_contents

If the log contents is not the empty string, then delete it. Why not 
just do:
test._log_contents = ''

So that you still have the attribute, and you just free the memory?

+                if attr is not not_found:

The "is not not_found" is a bit hard to parse, though I'm guessing there 
isn't a lot of choice here.

For details, see: 

More information about the bazaar mailing list