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