Commit 3af01a15 authored by Antoine Pitrou's avatar Antoine Pitrou

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.
........
parent d5f9bf5e
......@@ -680,6 +680,18 @@ class ReferencesTestCase(TestBase):
# 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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment