Re: Exception difference 2.4 ==> 2.5
D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: >I managed to move everything into one test file and switched to the >SimpleXMLRPCServer module but to no avail. The new code is at >ftp://ftp.druid.net/pub/distrib/test_2.5 It seems be this issue: http://bugs.python.org/issue1739842 Your handler in the server thread correctly catches the RuntimeException and converts into a Fault object which it returns. Unfortunately, xmlrpclib then throws an exception instead of marshalling the Fault object. Your server catches the exception and turns it into a 500 HTTP server error. The client thread then throws a ProtocolError, which is uncaught. So exceptions are working fine in your test case, the problem is that xmlrpclib.dumps() can't marshall xmlrpclib.Fault objects in 2.5. Ross Ridge -- l/ // Ross Ridge -- The Great HTMU [oo][oo] [EMAIL PROTECTED] -()-/()/ http://www.csclub.uwaterloo.ca/~rridge/ db // -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
On Wed, 19 Nov 2008 17:08:13 -0500 Terry Reedy <[EMAIL PROTECTED]> wrote: > > am running Python 2.5.2. I was able to reduce the program to a > > reasonably small version that exhibits the problem. It is in two files > > in ftp://ftp.druid.net/pub/distrib/Test_2.5.tgz including Fredrik > > Lundh's simple XML-RPC server. Just run the test program under 2.4, > > 2.5 and 2.6 to see the difference. > > Report it on the bugs.python.org and it might possibly get fixed. OK but I still don't think that I have even zeroed in on the bug. Even the code I provided is pretty large and complex for a snippet meant to identify the problem. I managed to move everything into one test file and switched to the SimpleXMLRPCServer module but to no avail. The new code is at ftp://ftp.druid.net/pub/distrib/test_2.5 -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
D'Arcy J.M. Cain wrote: If true I hope that a new version is forthcoming on the 2.5 branch. Yes, couple of weeks. I am running Python 2.5.2. I was able to reduce the program to a reasonably small version that exhibits the problem. It is in two files in ftp://ftp.druid.net/pub/distrib/Test_2.5.tgz including Fredrik Lundh's simple XML-RPC server. Just run the test program under 2.4, 2.5 and 2.6 to see the difference. Report it on the bugs.python.org and it might possibly get fixed. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
On Wed, 19 Nov 2008 11:20:48 -0800 "Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Wed, Nov 19, 2008 at 8:24 AM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > > Interesting. I installed 2.6 and tried it. My unit test still failed > > but for a different reason that I will have to investigate but the > > exceptions were handled correctly. Does this suggest something to you? > > I would wildly guess that you might have encountered a bug in Python > that was since fixed. Hard to be sure though. If true I hope that a new version is forthcoming on the 2.5 branch. I am running Python 2.5.2. I was able to reduce the program to a reasonably small version that exhibits the problem. It is in two files in ftp://ftp.druid.net/pub/distrib/Test_2.5.tgz including Fredrik Lundh's simple XML-RPC server. Just run the test program under 2.4, 2.5 and 2.6 to see the difference. -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
On Wed, Nov 19, 2008 at 8:24 AM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > On Tue, 18 Nov 2008 22:33:35 -0800 > "Chris Rebert" <[EMAIL PROTECTED]> wrote: >> What happens under Python 2.6? > > Interesting. I installed 2.6 and tried it. My unit test still failed > but for a different reason that I will have to investigate but the > exceptions were handled correctly. Does this suggest something to you? I would wildly guess that you might have encountered a bug in Python that was since fixed. Hard to be sure though. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com > > -- > D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves > http://www.druid.net/darcy/| and a sheep voting on > +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. > -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
On Tue, 18 Nov 2008 22:33:35 -0800 "Chris Rebert" <[EMAIL PROTECTED]> wrote: > What happens under Python 2.6? Interesting. I installed 2.6 and tried it. My unit test still failed but for a different reason that I will have to investigate but the exceptions were handled correctly. Does this suggest something to you? -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
On Wed, 19 Nov 2008 01:57:37 -0500 Ross Ridge <[EMAIL PROTECTED]> wrote: > D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > >Under Python 2.4 this works fine. If an exception is raised in the > >looked up method it gets handled by this code just fine. Under 2.5, > >however, the exception is not caught here. It's as if there was no > >try/except here at all. > > Python 2.5 changed the exception hierarchy a bit. The Exception class > is no longer at the root and now inheirits from BaseException. If the > exception being thrown was KeyboardInterrupt or SystemExit then it won't > be caught by your code. Yes, I was aware of that but the error not being caught is RuntimeError. I also tried a bare "except" just to be sure but same behaviour. -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: >Under Python 2.4 this works fine. If an exception is raised in the >looked up method it gets handled by this code just fine. Under 2.5, >however, the exception is not caught here. It's as if there was no >try/except here at all. Python 2.5 changed the exception hierarchy a bit. The Exception class is no longer at the root and now inheirits from BaseException. If the exception being thrown was KeyboardInterrupt or SystemExit then it won't be caught by your code. Ross Ridge -- l/ // Ross Ridge -- The Great HTMU [oo][oo] [EMAIL PROTECTED] -()-/()/ http://www.csclub.uwaterloo.ca/~rridge/ db // -- http://mail.python.org/mailman/listinfo/python-list
Re: Exception difference 2.4 ==> 2.5
On Tue, Nov 18, 2008 at 8:56 PM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > I am having a strange problem and I can't seem to zero in on it. I am > also having trouble reducing it to a small enough snippet that I can > post here. I think that I am doing what the more complex script does > but none of my attempts fail. So, here is a description just in case > someone has seen something that smells like this and can suggest some > areas to do further poking. > > I have a class that subclasses xmlrpcserver.RequestHandler. It has a > method that takes a function name that it looks up with getattr. It > then calls the looked up method in this try/except block: > >try: >return server_method(pkt) >except Exception, failure: >syslog(LOG_WARNING, "%s, %s" % (Exception, failure)) >self.print_tb(sys.exc_info()) > >try: fault = self.faultConverter.errorToFault(failure) >except Exception, err: >syslog(LOG_ERR, "Error processing failure: %r" % err) >fault = xmlrpclib.Fault(8002, "Internal error") > >syslog(LOG_DEBUG, "Converted failure %r to fault %r (%r)" % > \ (failure, fault, failure)) > >if fault.faultCode < 1: >syslog(LOG_ERR, "Unconverted fault: %r" % failure) > >return fault > > This class is then subclassed by another class that adds the methods > that are to be looked up. Those methods may raise exceptions if there > are errors. > > Under Python 2.4 this works fine. If an exception is raised in the > looked up method it gets handled by this code just fine. Under 2.5, > however, the exception is not caught here. It's as if there was no > try/except here at all. What happens under Python 2.6? Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com > > I'm not sure if I have left off some critical piece of information or > just littered this post with red herrings. I'm open to both > reasoned suggestions as well as wild speculation. > > -- > D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three wolves > http://www.druid.net/darcy/| and a sheep voting on > +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list