[Urwid] Bug: Signal module create backreferences

Ian Ward ian at excess.org
Sun Apr 4 22:25:14 EDT 2010

Dominic LoBue wrote on 2010-04-04 21:20:
> I fixed the ducktype implementation to not proxy anything other than
> methods and pushed it to my branch.

Here's an example of behaviour that I don't want with your current
signals_ducktype branch:

import urwid
b = urwid.Button("test")
class Foo(object):
    def react(self, b):
        print "reacting"

f = Foo()
urwid.connect_signal(b, 'click', f.react)
del f
b.keypress((10,), ' ') # this should print "reacting"

Instead it causes an error indicating that the callback has been
removed.  That's no good: a signal should be enough to keep the function
it's referencing alive.


More information about the Urwid mailing list