summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakref.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-10-04 07:00:02 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-10-04 07:00:02 (GMT)
commit8f657c35b978b681e6e919f08358992e1aed7dc1 (patch)
tree34ff476027bdeffd157fe8879baf9dde43ab2c45 /Lib/test/test_weakref.py
parentb47c9d29d763c9c24542e6de9191ef50da021ce6 (diff)
downloadcpython-8f657c35b978b681e6e919f08358992e1aed7dc1.zip
cpython-8f657c35b978b681e6e919f08358992e1aed7dc1.tar.gz
cpython-8f657c35b978b681e6e919f08358992e1aed7dc1.tar.bz2
ensure gc tracking is off when invoking weakref callbacks (closes #26617)
Diffstat (limited to 'Lib/test/test_weakref.py')
-rw-r--r--Lib/test/test_weakref.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 6d50a66..4cfaa54 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -845,6 +845,14 @@ class ReferencesTestCase(TestBase):
with self.assertRaises(AttributeError):
ref1.__callback__ = lambda ref: None
+ def test_callback_gcs(self):
+ class ObjectWithDel(Object):
+ def __del__(self): pass
+ x = ObjectWithDel(1)
+ ref1 = weakref.ref(x, lambda ref: support.gc_collect())
+ del x
+ support.gc_collect()
+
class SubclassableWeakrefTestCase(TestBase):