summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt4
-rw-r--r--pysnmp/smi/builder.py8
2 files changed, 7 insertions, 5 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index b815edb3..f2563d03 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,7 +1,9 @@
-Revision 4.4.7, released 2018-09-XX
+Revision 4.4.7, released 2018-11-XX
-----------------------------------
+- Use `compile()` before `exec`'ing MIB modules to attach filename to
+ the stack frames (ultimately shown in traceback/debugger)
- Fixed hlapi/v3arch transport target caching to ensure transport targets
are different even if just timeout/retries options differ
diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py
index 8b81b06c..a622d140 100644
--- a/pysnmp/smi/builder.py
+++ b/pysnmp/smi/builder.py
@@ -263,7 +263,7 @@ class MibBuilder(object):
self.mibSymbols = {}
self.__mibSources = []
self.__modSeen = {}
- self.__modPathsSeen = {}
+ self.__modPathsSeen = set()
self.__mibCompiler = None
self.setMibSources(*sources)
@@ -321,19 +321,19 @@ class MibBuilder(object):
debug.logger & debug.flagBld and debug.logger('loadModule: seen %s' % modPath)
break
else:
- self.__modPathsSeen[modPath] = 1
+ self.__modPathsSeen.add(modPath)
debug.logger & debug.flagBld and debug.logger('loadModule: evaluating %s' % modPath)
g = {'mibBuilder': self, 'userCtx': userCtx}
try:
- exec (modData, g)
+ exec(compile(modData, modPath, 'exec'), g)
except Exception:
del self.__modPathsSeen[modPath]
raise error.MibLoadError(
- 'MIB module \"%s\" load error: %s' % (modPath, traceback.format_exception(*sys.exc_info()))
+ 'MIB module \'%s\' load error: %s' % (modPath, traceback.format_exception(*sys.exc_info()))
)
self.__modSeen[modName] = modPath