[Python-checkins] r79538 - in python/branches/py3k: Lib/test/test_weakref.py
antoine.pitrou
python-checkins at python.org
Wed Mar 31 23:40:47 CEST 2010
Author: antoine.pitrou
Date: Wed Mar 31 23:40:47 2010
New Revision: 79538
Log:
NOTE: only ported the test for new-style classes.
Merged revisions 79535 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79535 | antoine.pitrou | 2010-03-31 23:32:15 +0200 (mer., 31 mars 2010) | 5 lines
Issue #8268: Old-style classes (not just instances) now support weak
references.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/test_weakref.py
Modified: python/branches/py3k/Lib/test/test_weakref.py
==============================================================================
--- python/branches/py3k/Lib/test/test_weakref.py (original)
+++ python/branches/py3k/Lib/test/test_weakref.py Wed Mar 31 23:40:47 2010
@@ -680,6 +680,18 @@
# No exception should be raised here
gc.collect()
+ def test_classes(self):
+ # Check that classes are weakrefable.
+ class A(object):
+ pass
+ l = []
+ weakref.ref(int)
+ a = weakref.ref(A, l.append)
+ A = None
+ gc.collect()
+ self.assertEqual(a(), None)
+ self.assertEqual(l, [a])
+
class SubclassableWeakrefTestCase(TestBase):
More information about the Python-checkins
mailing list