757 |
757 |
758 if cmd == DebugProtocol.RequestEval: |
758 if cmd == DebugProtocol.RequestEval: |
759 try: |
759 try: |
760 value = eval( |
760 value = eval( |
761 arg, self.currentThread.getCurrentFrame().f_globals, |
761 arg, self.currentThread.getCurrentFrame().f_globals, |
762 self.currentThread.getCurrentFrameLocals()) |
762 self.currentThread.getFrameLocals(0)) |
763 except: |
763 except: |
764 # Report the exception and the traceback |
764 # Report the exception and the traceback |
765 try: |
765 try: |
766 type, value, tb = sys.exc_info() |
766 type, value, tb = sys.exc_info() |
767 sys.last_type = type |
767 sys.last_type = type |
787 |
787 |
788 return |
788 return |
789 |
789 |
790 if cmd == DebugProtocol.RequestExec: |
790 if cmd == DebugProtocol.RequestExec: |
791 _globals = self.currentThread.getCurrentFrame().f_globals |
791 _globals = self.currentThread.getCurrentFrame().f_globals |
792 _locals = self.currentThread.getCurrentFrameLocals() |
792 _locals = self.currentThread.getFrameLocals(0) |
793 try: |
793 try: |
794 code = compile(arg + '\n', '<stdin>', 'single') |
794 code = compile(arg + '\n', '<stdin>', 'single') |
795 exec code in _globals, _locals |
795 exec code in _globals, _locals |
796 except: |
796 except: |
797 # Report the exception and the traceback |
797 # Report the exception and the traceback |
964 while cf is not None and frmnr > 0: |
964 while cf is not None and frmnr > 0: |
965 cf = cf.f_back |
965 cf = cf.f_back |
966 frmnr -= 1 |
966 frmnr -= 1 |
967 _globals = cf.f_globals |
967 _globals = cf.f_globals |
968 _locals = \ |
968 _locals = \ |
969 self.currentThread.getCurrentFrameLocals() |
969 self.currentThread.getFrameLocals( |
|
970 self.framenr) |
970 # reset sys.stdout to our redirector (unconditionally) |
971 # reset sys.stdout to our redirector (unconditionally) |
971 if "sys" in _globals: |
972 if "sys" in _globals: |
972 __stdout = _globals["sys"].stdout |
973 __stdout = _globals["sys"].stdout |
973 _globals["sys"].stdout = self.writestream |
974 _globals["sys"].stdout = self.writestream |
974 exec code in _globals, _locals |
975 exec code in _globals, _locals |