mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
ensure gc tracking is off when invoking weakref callbacks (closes #26617)
This commit is contained in:
parent
b47c9d29d7
commit
8f657c35b9
3 changed files with 23 additions and 12 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue