blob: 3fa96595b6dbe90f6a48c78743f2dc6168a73271 [file] [log] [blame]
Georg Brandl7e8bfa42006-01-10 19:29:24 +00001#
2# This file is for everybody to add tests for crashes that aren't
3# fixed yet. Please add a test case and appropriate description.
4#
5# When you fix one of the crashes, please move the test to the correct
6# test_ module.
7#
8
9import unittest
10from test import test_support
11
12
13# Bug 1377858
14#
15# mwh's description:
16# The problem is obvious if you read typeobject.c around line 660: the weakref
17# list is cleared before __del__ is called, so any weakrefs added during the
18# execution of __del__ are never informed of the object's death.
19
20import weakref
21ref = None
22
23class TestBug1377858(unittest.TestCase):
24 class Target(object):
25 def __del__(self):
26 global ref
27 ref = weakref.ref(self)
28
29 def testBug1377858(self):
30 w = self.__class__.Target()
31 w = None
32 print ref()
33
34def test_main():
35 test_support.run_unittest(TestBug1377858)
36
37if __name__ == "__main__":
38 test_main()