From: Antony K. <ant...@ya...> - 2005-09-11 16:06:03
|
--- "Mike C. Fletcher" <mcf...@ro...> wrote: > Antony Kummel wrote: > > >Hi! > > > >In an application I am working on, I'm getting an > >exception in dispatcher._removeReceiver, which > occurs, > >apparently, after the main script exits. When it is > >called, dispatcher.sendersBack is None! I suspect > that > >this is happening as part of Python's shutdown > >procedures which also affect the module's > interiors. > >Anyway, I made a patch that returns immediately > from > >_removeReceiver in case sendersBack is None, but I > >don't know what is causing it and whether this > >phenomenon could manifest itself in different ways. > >I'd be happy to help further if I can. > > > > > Python cleans up a module's namespace during > interpreter shutdown by > replacing everything in the dictionary with None. > Can you send me the > patch? (I know, I could probably recreate it fairly > quickly, but I'm > working on other stuff at the moment and don't want > to shift gears). > > Thanks, and have fun, > Mike > Here it is. I changed three things: 1. In dispatcher._removeReceiver, I check if sendersBack is None and if so do nothing. 2. In saferef.BoundMethodWeakref.__init__, the remove function may use traceback, which may also be none, so I check for that too. I suppose this only happened to me because _removeReceiver was raising an Exception, but let's do this for future generations' sake. 3. In saferef.BoundMethodWeakref.__repr__, I handled the case in which the weakFunc is dead. Regards, Antony Kummel ______________________________________________________ Yahoo! for Good Watch the Hurricane Katrina Shelter From The Storm concert http://advision.webevents.yahoo.com/shelter |