#35801: Signals are dispatched to receivers associated with dead senders
------------------------------+--------------------------------------
     Reporter:  bobince       |                    Owner:  (none)
         Type:  Bug           |                   Status:  closed
    Component:  Core (Other)  |                  Version:  5.1
     Severity:  Normal        |               Resolution:  needsinfo
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------
Comment (by bobince):

 > I don't think it's correct to clear receivers_called = [] like that
 inside the loop

 It should be fine as long as the loop is in the same scope as the
 definition of receivers_called. But yes, it might be clearer to reset the
 list without rebinding it by doing `del receivers_called[:]`.

 > Sadly, this does not fail for me at any iteration

 That's because the new example stores a reference to `sender` in
 `signal_calls`, which prevents the sender being destroyed and its id re-
 used.

 If you store `id(sender)` or `str(sender)` instead you'll get the error
 again.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35801#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701924ecb4835-cb7b956e-c3ef-4e29-987f-6f38fbe0f756-000000%40eu-central-1.amazonses.com.

Reply via email to