From: Antony K. <ant...@ya...> - 2005-09-05 14:06:27
|
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. Antony Kummel __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Mike C. F. <mcf...@ro...> - 2005-09-06 22:39:45
|
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 -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Antony K. <ant...@ya...> - 2005-09-11 16:06:03
Attachments:
dispatcher.py
saferef.py
|
--- "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 |
From: Mike C. F. <mcf...@ro...> - 2005-09-17 04:57:33
|
Antony Kummel wrote: ... >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. > > Okay, these changes are now in CVS, next time a release is done we'll have them. Thanks, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Antony K. <ant...@ya...> - 2005-09-11 16:11:10
|
Hi, Why not make send return the instances of exceptions if any occured in a receiver instead of making the whole operation break and possibly leave the user's system in an invalid state? I don't mind doing this too, if deemed useful. Antony Kummel ______________________________________________________ Yahoo! for Good Watch the Hurricane Katrina Shelter From The Storm concert http://advision.webevents.yahoo.com/shelter |
From: Mike C. F. <mcf...@ro...> - 2005-09-17 05:33:48
|
Antony Kummel wrote: >Hi, > >Why not make send return the instances of exceptions >if any occured in a receiver instead of making the >whole operation break and possibly leave the user's >system in an invalid state? I don't mind doing this >too, if deemed useful. > > Altering the *current* API like this would *not* be advisable. It would have all sorts of ugly potential failure cases (where a user is assuming errors will propagate the stop). Adding a new "sendRobust" might be well received. Probably do it as a separate module (i.e. from dispatch.robust import sendRobust) rather than making it part of the "dispatcher" namespace? The problem then is that as soon as you do that, you realise what you actually want is something like a Twisted.python.failure.Failure object, i.e. something that lets you get at the traceback for the individual failure as well, or you could do it with callbacks and errbacks... or... there's just so many different variations on the theme that it's hard to know which really belong in the core. A straightforward sendRobust implementation (no tracebacks, just the error instances) is probably a good idea for the core, though. Okay, that's added now. Have fun, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |