mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
Issue #18112: PEP 442 implementation (safe object finalization).
This commit is contained in:
parent
c5d95b17ac
commit
796564c27b
25 changed files with 1254 additions and 321 deletions
|
|
@ -3736,18 +3736,8 @@ order (MRO) for bases """
|
|||
# bug).
|
||||
del c
|
||||
|
||||
# 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. (On non-CPython implementations, however, __del__
|
||||
# is typically not called again.)
|
||||
support.gc_collect()
|
||||
self.assertEqual(len(C.container), 1)
|
||||
del C.container[-1]
|
||||
if support.check_impl_detail():
|
||||
support.gc_collect()
|
||||
self.assertEqual(len(C.container), 1)
|
||||
self.assertEqual(C.container[-1].attr, 42)
|
||||
|
||||
# Make c mortal again, so that the test framework with -l doesn't report
|
||||
# it as a leak.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue