Commits

Peter Feiner committed fcfc9ef

fix issue 15: inspect.stack() assumes a non-blank filename

  • Participants
  • Parent commits 832504c

Comments (0)

Files changed (2)

File execnet/gateway_base.py

                             (channel.id, repr(source)[:50]))
             channel._executing = True
             try:
-                co = compile(source+'\n', '', 'exec')
+                co = compile(source+'\n', '<remote exec>', 'exec')
                 do_exec(co, loc)
                 if call_name:
                     self._trace('calling %s(**%60r)' % (call_name, kwargs))

File testing/test_basics.py

     py.test.raises(TypeError, gw.remote_exec, gateway_base, kwarg=1)
     py.test.raises(TypeError, gw.remote_exec, 'pass', kwarg=1)
 
+def test_remote_exec_inspect_stack(makegateway):
+    gw = makegateway()
+    ch = gw.remote_exec("""
+        import inspect
+        inspect.stack()
+        import traceback
+        channel.send('\\n'.join(traceback.format_stack()))
+    """)
+    assert 'File "<remote exec>"' in ch.receive()
+    ch.waitclose()