summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-07-11 18:26:21 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-07-11 18:26:21 (GMT)
commit14cb1e1eff09fc8b93681c4c0b00a21862817159 (patch)
tree19dc27d37c221c2beca66519cadc8ef67bc1a825 /Lib/test/test_descr.py
parent76c81eecfa0b2a8a8a62a593ac2bd8c3e6c79acd (diff)
downloadcpython-14cb1e1eff09fc8b93681c4c0b00a21862817159.zip
cpython-14cb1e1eff09fc8b93681c4c0b00a21862817159.tar.gz
cpython-14cb1e1eff09fc8b93681c4c0b00a21862817159.tar.bz2
subtype_resurrection(): The test suite with -l properly reported the
immortal object here as a leak. Made the object mortal again at the end.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index bbc6706..ff5cefe 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3184,6 +3184,7 @@ def slices():
vereq(a, [2,3,1])
def subtype_resurrection():
+ import gc
if verbose:
print "Testing resurrection of new-style instance..."
@@ -3196,12 +3197,22 @@ def subtype_resurrection():
c = C()
c.attr = 42
- # The only interesting thing here is whether this blows up, due to flawed
+ # The most interesting thing here is whether this blows up, due to flawed
# GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug).
del c
- del C.container[-1] # resurrect it again for the heck of it
+
+ # If that didn't blow up, it's also interesting to see whether clearing
+ # the last container slot works: that will attempt to delete c again,
+ # which will cause c to get appended back to the container again "during"
+ # the del.
+ del C.container[-1]
+ vereq(len(C.container), 1)
vereq(C.container[-1].attr, 42)
+ # Make c mortal again, so that the test framework with -l doesn't report
+ # it as a leak.
+ del C.__del__
+
def do_this_first():
if verbose:
print "Testing SF bug 551412 ..."