1. Holger Krekel
  2. execnet
  3. Issues
Issue #15 resolved

remote_exec breaks inspect.stack() assumptions

Peter Feiner
created an issue

inspect.stack() assumes that file names contain at least one character:

(venv)peter@gremlin:~/workspace/execnet$ cat test.py
import execnet
gw = execnet.makegateway()
c = gw.remote_exec('import inspect; inspect.stack();')
(venv)peter@gremlin:~/workspace/execnet$ python test.py
Traceback (most recent call last):
  File "test.py", line 4, in <module>
  File "/home/peter/workspace/execnet/execnet/gateway_base.py", line 412, in waitclose
    raise error
execnet.gateway_base.RemoteError: Traceback (most recent call last):
  File "/home/peter/workspace/execnet/execnet/gateway_base.py", line 800, in executetask
    do_exec(co, loc)
  File "<string>", line 1, in do_exec
  File "", line 1, in <module>
  File "/usr/lib/python2.7/inspect.py", line 1054, in stack
    return getouterframes(sys._getframe(1), context)
  File "/usr/lib/python2.7/inspect.py", line 1032, in getouterframes
    framelist.append((frame,) + getframeinfo(frame, context))
  File "/usr/lib/python2.7/inspect.py", line 1007, in getframeinfo
    lines, lnum = findsource(frame)
  File "/usr/lib/python2.7/inspect.py", line 528, in findsource
    if not sourcefile and file[0] + file[-1] != '<>':
IndexError: string index out of range

I'll submit a pull request momentarily.

Comments (3)

  1. Log in to comment