769 |
769 |
770 if cmd == DebugProtocol.RequestEval: |
770 if cmd == DebugProtocol.RequestEval: |
771 try: |
771 try: |
772 value = eval( |
772 value = eval( |
773 arg, self.currentThread.getCurrentFrame().f_globals, |
773 arg, self.currentThread.getCurrentFrame().f_globals, |
774 self.currentThread.getFrameLocals(0)) |
774 self.currentThread.getFrameLocals(self.framenr)) |
775 except: |
775 self.currentThread.storeFrameLocals(self.framenr) |
776 # Report the exception and the traceback |
776 # Report the exception and the traceback |
777 try: |
777 try: |
778 type, value, tb = sys.exc_info() |
778 type, value, tb = sys.exc_info() |
779 sys.last_type = type |
779 sys.last_type = type |
780 sys.last_value = value |
780 sys.last_value = value |
799 |
799 |
800 return |
800 return |
801 |
801 |
802 if cmd == DebugProtocol.RequestExec: |
802 if cmd == DebugProtocol.RequestExec: |
803 _globals = self.currentThread.getCurrentFrame().f_globals |
803 _globals = self.currentThread.getCurrentFrame().f_globals |
804 _locals = self.currentThread.getFrameLocals(0) |
804 _locals = self.currentThread.getFrameLocals(self.framenr) |
805 try: |
805 try: |
806 code = compile(arg + '\n', '<stdin>', 'single') |
806 code = compile(arg + '\n', '<stdin>', 'single') |
807 exec code in _globals, _locals |
807 exec code in _globals, _locals |
808 except: |
808 self.currentThread.storeFrameLocals(self.framenr) |
809 # Report the exception and the traceback |
809 # Report the exception and the traceback |
810 try: |
810 try: |
811 type, value, tb = sys.exc_info() |
811 type, value, tb = sys.exc_info() |
812 sys.last_type = type |
812 sys.last_type = type |
813 sys.last_value = value |
813 sys.last_value = value |
992 _locals["sys"].stdout = self.writestream |
992 _locals["sys"].stdout = self.writestream |
993 exec code in _globals, _locals |
993 exec code in _globals, _locals |
994 _locals["sys"].stdout = __stdout |
994 _locals["sys"].stdout = __stdout |
995 else: |
995 else: |
996 exec code in _globals, _locals |
996 exec code in _globals, _locals |
|
997 |
|
998 self.currentThread.storeFrameLocals(self.framenr) |
997 except SystemExit, exc: |
999 except SystemExit, exc: |
998 self.progTerminated(exc.code) |
1000 self.progTerminated(exc.code) |
999 except: |
1001 except: |
1000 # Report the exception and the traceback |
1002 # Report the exception and the traceback |
1001 try: |
1003 try: |