diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-02-09 17:47:15 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-02-09 17:47:15 +0100 |
commit | 2b5603ecf98c1c47e94a405bd98054d1703af9e7 (patch) | |
tree | d0f544c895b238fbb5660dbf23b3d54c31bfa0b9 /pysnmp/proto/mpmod/rfc3412.py | |
parent | 05b982f4b1cfa143d6fa607a6b9b24d3a77981a1 (diff) | |
download | pysnmp-git-2b5603ecf98c1c47e94a405bd98054d1703af9e7.tar.gz |
Drop Python < 2.6 except statement compatibility trick
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) |