Fixed #21952 -- signals deadlock due to locking + weakref interaction

This commit is contained in:
Anssi Kääriäinen 2014-02-04 20:19:14 +02:00 committed by Florian Apolloner
parent aea9faa146
commit c29d6f7676
2 changed files with 27 additions and 17 deletions

View file

@ -46,11 +46,12 @@ class DispatcherTests(unittest.TestCase):
def _testIsClean(self, signal):
"""Assert that everything has been cleaned up automatically"""
# Note that dead weakref cleanup happens as side effect of using
# the signal's receivers through the signals API. So, first do a
# call to an API method to force cleanup.
self.assertFalse(signal.has_listeners())
self.assertEqual(signal.receivers, [])
# force cleanup just in case
signal.receivers = []
def testExact(self):
a_signal.connect(receiver_1_arg, sender=self)
expected = [(receiver_1_arg, "test")]