summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2009-08-25 16:04:41 +0000
committerRafael H. Schloming <rhs@apache.org>2009-08-25 16:04:41 +0000
commit41c5a4f995cf16505f92257a0aa08ae967c8d466 (patch)
treefe4283ba8fba6cc7910499e9e80294f6b76fd376
parent868ec0d1166838449df1186858cecf517c97d799 (diff)
downloadqpid-python-41c5a4f995cf16505f92257a0aa08ae967c8d466.tar.gz
fallback to format_exception for python 2.3
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@807684 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--python/qpid/compat.py7
-rw-r--r--python/qpid/messaging.py4
2 files changed, 9 insertions, 2 deletions
diff --git a/python/qpid/compat.py b/python/qpid/compat.py
index 26f60fb8aa..49273193df 100644
--- a/python/qpid/compat.py
+++ b/python/qpid/compat.py
@@ -26,3 +26,10 @@ try:
from socket import SHUT_RDWR
except ImportError:
SHUT_RDWR = 2
+
+try:
+ from traceback import format_exc
+except ImportError:
+ import sys, traceback
+ def format_exc():
+ return "".join(traceback.format_exception(*sys.exc_info()))
diff --git a/python/qpid/messaging.py b/python/qpid/messaging.py
index 47f7e560c5..3c41a2c417 100644
--- a/python/qpid/messaging.py
+++ b/python/qpid/messaging.py
@@ -30,7 +30,7 @@ Areas that still need work:
- protocol negotiation/multiprotocol impl
"""
-import connection, time, socket, sys, traceback
+import connection, time, socket, sys, compat
from codec010 import StringCodec
from datatypes import timestamp, uuid4, RangedSet, Message as Message010, Serial
from exceptions import Timeout
@@ -907,7 +907,7 @@ class Driver(Lockable):
exi = sys.exc_info()
if exi:
- msg = traceback.format_exc()
+ msg = compat.format_exc()
recoverable = ["aborted", "Connection refused", "SessionDetached", "Connection reset by peer",
"Bad file descriptor", "start timed out", "Broken pipe"]
for r in recoverable: