[Urwid] Bug: Signal module create backreferences
dominic.lobue at gmail.com
Mon Apr 5 11:11:05 EDT 2010
On Sunday, April 4, 2010, Ian Ward <ian at excess.org> wrote:
> 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.
> Urwid mailing list
> Urwid at lists.excess.org
Personally, I disagree. Besides that causing memory leaks, i think
deleting an object also means deleting its functions.
I mean why would you delete an object, or allow all references to an
object be deleted if you were not done with it yet?
More information about the Urwid