diff options
Diffstat (limited to 'pysnmp/proto/mpmod/rfc3412.py')
-rw-r--r-- | pysnmp/proto/mpmod/rfc3412.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pysnmp/proto/mpmod/rfc3412.py b/pysnmp/proto/mpmod/rfc3412.py index 58f3acc0..bda72cd9 100644 --- a/pysnmp/proto/mpmod/rfc3412.py +++ b/pysnmp/proto/mpmod/rfc3412.py @@ -530,8 +530,8 @@ class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel): ) debug.logger & debug.flagMP and debug.logger('prepareDataElements: SM succeeded') - except error.StatusInformation: - statusInformation, origTraceback = sys.exc_info()[1:3] + except error.StatusInformation as exc: + statusInformation = exc debug.logger & debug.flagMP and debug.logger( 'prepareDataElements: SM failed, statusInformation %s' % statusInformation) @@ -596,8 +596,11 @@ class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel): if sys.version_info[0] <= 2: raise statusInformation else: + origTraceback = sys.exc_info()[2] + try: raise statusInformation.with_traceback(origTraceback) + finally: # Break cycle between locals and traceback object # (seems to be irrelevant on Py3 but just in case) |