773 if cmd == DebugProtocol.RequestEval: |
773 if cmd == DebugProtocol.RequestEval: |
774 try: |
774 try: |
775 value = eval( |
775 value = eval( |
776 arg, |
776 arg, |
777 self.currentThread.getCurrentFrame().f_globals, |
777 self.currentThread.getCurrentFrame().f_globals, |
778 self.currentThread.getFrameLocals(0)) |
778 self.currentThread.getFrameLocals(self.framenr)) |
779 except: |
779 self.currentThread.storeFrameLocals(self.framenr) |
780 # Report the exception and the traceback |
780 # Report the exception and the traceback |
781 try: |
781 try: |
782 type, value, tb = sys.exc_info() |
782 type, value, tb = sys.exc_info() |
783 sys.last_type = type |
783 sys.last_type = type |
784 sys.last_value = value |
784 sys.last_value = value |
804 |
804 |
805 return |
805 return |
806 |
806 |
807 if cmd == DebugProtocol.RequestExec: |
807 if cmd == DebugProtocol.RequestExec: |
808 _globals = self.currentThread.getCurrentFrame().f_globals |
808 _globals = self.currentThread.getCurrentFrame().f_globals |
809 _locals = self.currentThread.getFrameLocals(0) |
809 _locals = self.currentThread.getFrameLocals(self.framenr) |
810 try: |
810 try: |
811 code = compile(arg + '\n', '<stdin>', 'single') |
811 code = compile(arg + '\n', '<stdin>', 'single') |
812 exec(code, _globals, _locals) |
812 exec(code, _globals, _locals) |
813 except: |
813 self.currentThread.storeFrameLocals(self.framenr) |
814 # Report the exception and the traceback |
814 # Report the exception and the traceback |
815 try: |
815 try: |
816 type, value, tb = sys.exc_info() |
816 type, value, tb = sys.exc_info() |
817 sys.last_type = type |
817 sys.last_type = type |
818 sys.last_value = value |
818 sys.last_value = value |
994 _locals["sys"].stdout = self.writestream |
994 _locals["sys"].stdout = self.writestream |
995 exec(code, _globals, _locals) |
995 exec(code, _globals, _locals) |
996 _locals["sys"].stdout = __stdout |
996 _locals["sys"].stdout = __stdout |
997 else: |
997 else: |
998 exec(code, _globals, _locals) |
998 exec(code, _globals, _locals) |
|
999 |
|
1000 self.currentThread.storeFrameLocals(self.framenr) |
999 except SystemExit as exc: |
1001 except SystemExit as exc: |
1000 self.progTerminated(exc.code) |
1002 self.progTerminated(exc.code) |
1001 except: |
1003 except: |
1002 # Report the exception and the traceback |
1004 # Report the exception and the traceback |
1003 try: |
1005 try: |