mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #21952 -- signals deadlock due to locking + weakref interaction
This commit is contained in:
parent
aea9faa146
commit
c29d6f7676
2 changed files with 27 additions and 17 deletions
|
@ -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")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue