  
  class PyFrameObjectPtr(PyObjectPtr):
      _typename = 'PyFrameObject'
-@@ -861,7 +861,10 @@ class PyFrameObjectPtr(PyObjectPtr):
+@@ -892,7 +892,10 @@ class PyFrameObjectPtr(PyObjectPtr):
          '''Get the path of the current Python source file, as a string'''
          if self.is_optimized_out():
              return '(frame information optimized out)'

 class PyObjectPtr(object):
     """
     Class wrapping a gdb.Value that's a either a (PyObject*) within the
@@ -232,28 +250,8 @@ class PyObjectPtr(object):
         visiting object graphs with loops).  Analogous to Py_ReprEnter and
         Py_ReprLeave
         '''

             out.write('=')
             pyop_value.write_repr(out, visited)
 
@@ -1392,8 +1395,13 @@ class Frame(object):
                 write_unicode(sys.stdout, '#%i %s\n' % (self.get_index(), line))
                 if not pyop.is_optimized_out():
                     line = pyop.current_line()
-                    if line is not None:
-                        sys.stdout.write('    %s\n' % line.strip())
+                    try:
+                        line = pyop.current_line()
+                        if line is not None:
+                            sys.stdout.write('    %s\n' % line.strip())
+                    except CantReadFilename:
+                        if line is not None:
+                            sys.stdout.write('    %s\n' % '(unable to read filename)')
             else:
                 sys.stdout.write('#%i (unable to read python frame information)\n' % self.get_index())
         else:
@@ -1466,7 +1474,11 @@ class PyList(gdb.Command):
             print('Unable to read information on python frame')
             return
 
