DebugClients/Python3/DebugClientBase.py

branch
6_1_x
changeset 4643
705ee8ad484f
parent 4632
ca310db386ed
child 4644
99699903c454
equal deleted inserted replaced
4641:9fcce00f9714 4643:705ee8ad484f
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:
1357 dict = self.debugMod.__dict__ 1359 dict = self.debugMod.__dict__
1358 else: 1360 else:
1359 scope = -1 1361 scope = -1
1360 elif scope: 1362 elif scope:
1361 dict = f.f_globals 1363 dict = f.f_globals
1364 elif f.f_globals is f.f_locals:
1365 scope = -1
1362 else: 1366 else:
1363 dict = f.f_locals 1367 dict = f.f_locals
1364 1368
1365 if f.f_globals is f.f_locals:
1366 scope = -1
1367
1368 varlist = [scope] 1369 varlist = [scope]
1369 1370
1370 if scope != -1: 1371 if scope != -1:
1371 keylist = dict.keys() 1372 keylist = dict.keys()
1372 1373
1402 dict = self.debugMod.__dict__ 1403 dict = self.debugMod.__dict__
1403 else: 1404 else:
1404 scope = -1 1405 scope = -1
1405 elif scope: 1406 elif scope:
1406 dict = f.f_globals 1407 dict = f.f_globals
1408 elif f.f_globals is f.f_locals:
1409 scope = -1
1407 else: 1410 else:
1408 dict = f.f_locals 1411 dict = f.f_locals
1409
1410 if f.f_globals is f.f_locals:
1411 scope = -1
1412 1412
1413 varlist = [scope, var] 1413 varlist = [scope, var]
1414 1414
1415 if scope != -1: 1415 if scope != -1:
1416 # search the correct dictionary 1416 # search the correct dictionary

eric ide

mercurial