[Urwid] Bug: Signal module create backreferences

Dominic LoBue dom.lobue at gmail.com
Mon Mar 8 05:15:52 EST 2010


On Sat, Mar 6, 2010 at 11:50 AM, Ian Ward <ian at excess.org> wrote:
> Dominic LoBue wrote:
>> Ian,
>>
>> I have a working implementation. By no means is it elegant, but it works.
>>
>> Basically instead of holding onto the specific method that is to be
>> called when a signal is recieved, we instead hold onto a tuple of
>> (ref(parentwithmethod), 'methodname'). When the signal is activated,
>> we use getattr to get an instance of the method we want and then run
>> that method.
>>
>> Working examples can be found here:
>> http://gist.github.com/322577
>> http://gist.github.com/322576
>
> That's great, sounds like you're close to a good solution,
>
> Why don't you fork urwid on github so I can see the changes a little
> more easily?
>
> Ian
>
>
>
> _______________________________________________
> Urwid mailing list
> Urwid at lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
>

Good idea.

I wasn't sure whether it was better to use duck typing or explicit
type checking (in case there might be more edge-cases that cause
memory leaks), so I create a branch for both:
http://github.com/dlobue/urwid/tree/signals_ducktype
http://github.com/dlobue/urwid/tree/signals_explicit

While my app still uses a ton of memory, this fix has helped a ton.

-- 
Dominic LoBue



More information about the Urwid mailing list