From e65d33b89c1f4ed1c55ab2f832b91354960e6e16 Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sun, 29 Jun 2014 20:05:12 -0700 Subject: [PATCH] Warn that signal receivers are weakly-referenced For the signal get_generators in particular, it may seem natural to use a lambda or inner function as the signal receiver, but this does not work as the receiver is collected before it can be called. --- docs/plugins.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/plugins.rst b/docs/plugins.rst index 27299e83..78f6ccd0 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -57,6 +57,12 @@ which you map the signals to your plugin logic. Let's take a simple example:: def register(): signals.initialized.connect(test) +.. note:: + + Signal receivers are weakly-referenced and thus must not be defined within + your ``register`` callable or they will be garbage-collected before the + signal is emitted. + List of signals ===============