689 return |
689 return |
690 |
690 |
691 if cmd == RequestEval: |
691 if cmd == RequestEval: |
692 try: |
692 try: |
693 value = eval(arg, self.currentThread.getCurrentFrame().f_globals, |
693 value = eval(arg, self.currentThread.getCurrentFrame().f_globals, |
694 self.currentThread.getCurrentFrame().f_locals) |
694 self.currentThread.getCurrentFrameLocals()) |
695 except: |
695 except: |
696 # Report the exception and the traceback |
696 # Report the exception and the traceback |
697 try: |
697 try: |
698 type, value, tb = sys.exc_info() |
698 type, value, tb = sys.exc_info() |
699 sys.last_type = type |
699 sys.last_type = type |
720 |
720 |
721 return |
721 return |
722 |
722 |
723 if cmd == RequestExec: |
723 if cmd == RequestExec: |
724 _globals = self.currentThread.getCurrentFrame().f_globals |
724 _globals = self.currentThread.getCurrentFrame().f_globals |
725 _locals = self.currentThread.getCurrentFrame().f_locals |
725 _locals = self.currentThread.getCurrentFrameLocals() |
726 try: |
726 try: |
727 code = compile(arg + '\n', '<stdin>', 'single') |
727 code = compile(arg + '\n', '<stdin>', 'single') |
728 exec(code, _globals, _locals) |
728 exec(code, _globals, _locals) |
729 except: |
729 except: |
730 # Report the exception and the traceback |
730 # Report the exception and the traceback |
885 frmnr = self.framenr |
885 frmnr = self.framenr |
886 while cf is not None and frmnr > 0: |
886 while cf is not None and frmnr > 0: |
887 cf = cf.f_back |
887 cf = cf.f_back |
888 frmnr -= 1 |
888 frmnr -= 1 |
889 _globals = cf.f_globals |
889 _globals = cf.f_globals |
890 _locals = cf.f_locals |
890 _locals = self.currentThread.getCurrentFrameLocals() |
891 # reset sys.stdout to our redirector (unconditionally) |
891 # reset sys.stdout to our redirector (unconditionally) |
892 if "sys" in _globals: |
892 if "sys" in _globals: |
893 __stdout = _globals["sys"].stdout |
893 __stdout = _globals["sys"].stdout |
894 _globals["sys"].stdout = self.writestream |
894 _globals["sys"].stdout = self.writestream |
895 exec(code, _globals, _locals) |
895 exec(code, _globals, _locals) |