DebugClients/Python3/DebugClientBase.py

branch
5_1_x
changeset 936
f6bc16bd4198
parent 791
9ec2ac20e54e
child 945
8cd4d08fa9f6
child 1181
31d20dc43805
equal deleted inserted replaced
931:d8a11b6a7d49 936:f6bc16bd4198
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)

eric ide

mercurial