Rev 6027: (vila) Work around some Python 2.7 versions not providing in file:///home/pqm/archives/thelove/bzr/2.4/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Aug 9 20:17:01 UTC 2011
At file:///home/pqm/archives/thelove/bzr/2.4/
------------------------------------------------------------
revno: 6027 [merge]
revision-id: pqm at pqm.ubuntu.com-20110809201657-03q8kptf7tn1c9mw
parent: pqm at pqm.ubuntu.com-20110806012906-nhbhiz93ghzdaew3
parent: jelmer at samba.org-20110809091117-wejv7gvu0wsa7dk8
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.4
timestamp: Tue 2011-08-09 20:16:57 +0000
message:
(vila) Work around some Python 2.7 versions not providing
TestCase._type_equality_funcs.clear(). (Jelmer Vernooij)
modified:
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2011-07-27 05:05:15 +0000
+++ b/bzrlib/tests/__init__.py 2011-08-09 09:11:17 +0000
@@ -386,9 +386,18 @@
getDetails = getattr(test, "getDetails", None)
if getDetails is not None:
getDetails().clear()
+ # Clear _type_equality_funcs to try to stop TestCase instances
+ # from wasting memory. 'clear' is not available in all Python
+ # versions (bug 809048)
type_equality_funcs = getattr(test, "_type_equality_funcs", None)
if type_equality_funcs is not None:
- type_equality_funcs.clear()
+ tef_clear = getattr(type_equality_funcs, "clear", None)
+ if tef_clear is None:
+ tef_instance_dict = getattr(type_equality_funcs, "__dict__", None)
+ if tef_instance_dict is not None:
+ tef_clear = tef_instance_dict.clear
+ if tef_clear is not None:
+ tef_clear()
self._traceback_from_test = None
def startTests(self):
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-07-27 13:17:45 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-08-09 09:11:17 +0000
@@ -63,6 +63,10 @@
avoiding an extra SSH connection, etc.
(John Arbash Meinel, #812285)
+* Cope with not all Python versions having a ``clear`` method on
+ ``TestCase._type_equality_funcs``. (#809048, Martin [gz], Jelmer
+ Vernooij)
+
Documentation
*************
More information about the bazaar-commits
mailing list