summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2011-12-23 15:10:34 +0000
committerelie <elie>2011-12-23 15:10:34 +0000
commitd6302cf2d88474a5f2d9e412771c7317d14210e5 (patch)
tree1029cd0832d393441287755b6bdbcf66faf91bfd
parent7c5b7760f1e9f77f617688a1f760090de1fa2fef (diff)
downloadpysnmp-d6302cf2d88474a5f2d9e412771c7317d14210e5.tar.gz
whilst on Py3, reraise exceptions with the original traceback
-rw-r--r--CHANGES2
-rw-r--r--pysnmp/smi/instrum.py12
2 files changed, 12 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 841b038..cbeab8b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -21,6 +21,8 @@ Revision 4.2.2
push them into MIB modules globals(). This is to facilitate
passing user infomation, such as DB connection handler, to MIB
module namespace so it could be used by ManagedObjects implementations.
+- When running on Python3, SMI will re-raise exceptions with the original
+ traceback for easier diagnostics.
- Fix to oneliner configuration routine that used to implicitly
tag SNMPv1/v2c auth and transport LCD rows what resulted in
huge delays when processing incoming messages wish large number
diff --git a/pysnmp/smi/instrum.py b/pysnmp/smi/instrum.py
index df392e4..c9cba39 100644
--- a/pysnmp/smi/instrum.py
+++ b/pysnmp/smi/instrum.py
@@ -211,7 +211,7 @@ class MibInstrumController:
except error.SmiError:
debug.logger & debug.flagIns and debug.logger('flipFlopFsm: fun %s failed %s for %s=%r' % (f, sys.exc_info()[1], name, val))
if myErr is None: # Take the first exception
- myErr = sys.exc_info()[1]
+ myErr = sys.exc_info()
status = 'err'
break
else:
@@ -220,7 +220,15 @@ class MibInstrumController:
outputNameVals.append((rval[0], rval[1]))
idx = idx + 1
if myErr:
- raise myErr
+ if sys.version_info[0] <= 2:
+ raise myErr[1]
+ else:
+ try:
+ raise myErr[1].with_traceback(myErr[2])
+ finally:
+ # Break cycle between locals and traceback object
+ # (seems to be irrelevant on Py3 but just in case)
+ del myErr
return outputNameVals
def readVars(self, vars, acInfo=(None, None)):