DebugClients/Python/DebugBase.py

changeset 5684
a46555ca12bc
parent 5674
a0ad2dcb27f9
child 5700
3bcd20e99b52
--- a/DebugClients/Python/DebugBase.py	Sat Apr 08 19:23:04 2017 +0200
+++ b/DebugClients/Python/DebugBase.py	Sat Apr 08 20:31:04 2017 +0200
@@ -578,19 +578,22 @@
         """
         # get module name from __file__
         fn = frame.f_globals.get('__file__')
-        try:
-            return self._fnCache[fn]
-        except KeyError:
-            absFilename = os.path.abspath(fn)
-            if absFilename.endswith(('.pyc', '.pyo')):
-                fixedName = absFilename[:-1]
-                if not os.path.exists(fixedName):
+        if fn is not None:
+            try:
+                return self._fnCache[fn]
+            except KeyError:
+                absFilename = os.path.abspath(fn)
+                if absFilename.endswith(('.pyc', '.pyo')):
+                    fixedName = absFilename[:-1]
+                    if not os.path.exists(fixedName):
+                        fixedName = absFilename
+                else:
                     fixedName = absFilename
-            else:
-                fixedName = absFilename
-            # update cache
-            self._fnCache[fn] = fixedName
-            return fixedName
+                # update cache
+                self._fnCache[fn] = fixedName
+                return fixedName
+        else:
+            return frame.f_code.co_filename
 
     def __checkBreakInFrame(self, frame):
         """

eric ide

mercurial