473,473 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Exception difference 2.4 ==> 2.5

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 < 10000:
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.

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 <da***@druid.net | 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.
Nov 19 '08 #1
2 5683
D'Arcy J.M. Cain <da***@druid.netwrote:
>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] rr****@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
Nov 19 '08 #2
On Wed, 19 Nov 2008 01:57:37 -0500
Ross Ridge <rr****@csclub.uwaterloo.cawrote:
D'Arcy J.M. Cain <da***@druid.netwrote:
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 <da***@druid.net | 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.
Nov 19 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lionel B | last post by:
Greetings, Using gcc (GCC) 3.3.3 (cygwin special) on Win2K Does anyone know if there is a convenient mechanism to cause a C++ exception to be thrown whenever a IEEE 754 floating-point...
13
by: Markus Elfring | last post by:
Do you know a class library that can convert the error/return codes that are listed in the standard header file "errno.h" into a well-known exception hierarchy? Did anybody derive it from...
822
by: Turamnvia Suouriviaskimatta | last post by:
I 'm following various posting in "comp.lang.ada, comp.lang.c++ , comp.realtime, comp.software-eng" groups regarding selection of a programming language of C, C++ or Ada for safety critical...
4
by: Seamus M | last post by:
It seems when I use the getLine() method of the Exception class, it returns the line number of the "throw new Exception" statement and not the line number where the error actually occured in the...
3
by: Blaise Garant | last post by:
Hi I've made a stylesheet to transform my data into XSL-FO. This stylesheet used to work with MSXSL 4.0 but I've got some issues in ..NET. First, I changed removed all the "node-set()" function...
19
by: Coward 9 | last post by:
HI, I saw in an example hello.aspx, there is a <form tagbeing used like <form runat="server> I search all html tag references and could NOT find "runat" attributes for <formtag. which...
9
by: Stephan Steiner | last post by:
Hi I seem to have a bit of trouble understanding one bit of how generics work: In C#, every class automatically derives from object, and inherits a bunch of properties (i.e. ToString()). Thus,...
0
by: Chris Rebert | last post by:
On Tue, Nov 18, 2008 at 8:56 PM, D'Arcy J.M. Cain <darcy@druid.netwrote: What happens under Python 2.6? Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com
0
by: Chris Rebert | last post by:
On Wed, Nov 19, 2008 at 11:24 PM, Barak, Ron <Ron.Barak@lsi.comwrote: As I believe someone else pointed out recently in a extremely similar thread, GzipFile apparently doesn't check that the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.