| 571 | |
| 572 | |
| 573 | class Executive: |
| 574 | |
| 575 | def __init__(self, rpchandler): |
| 576 | self.rpchandler = rpchandler |
| 577 | if idlelib.testing is False: |
| 578 | self.locals = __main__.__dict__ |
| 579 | self.calltip = calltip.Calltip() |
| 580 | self.autocomplete = autocomplete.AutoComplete() |
| 581 | else: |
| 582 | self.locals = {} |
| 583 | |
| 584 | def runcode(self, code): |
| 585 | global interruptible |
| 586 | try: |
| 587 | self.user_exc_info = None |
| 588 | interruptible = True |
| 589 | try: |
| 590 | exec(code, self.locals) |
| 591 | finally: |
| 592 | interruptible = False |
| 593 | except SystemExit as e: |
| 594 | if e.args: # SystemExit called with an argument. |
| 595 | ob = e.args[0] |
| 596 | if not isinstance(ob, (type(None), int)): |
| 597 | print('SystemExit: ' + str(ob), file=sys.stderr) |
| 598 | # Return to the interactive prompt. |
| 599 | except: |
| 600 | self.user_exc_info = sys.exc_info() # For testing, hook, viewer. |
| 601 | if quitting: |
| 602 | exit() |
| 603 | if sys.excepthook is sys.__excepthook__: |
| 604 | print_exception() |
| 605 | else: |
| 606 | try: |
| 607 | sys.excepthook(*self.user_exc_info) |
| 608 | except: |
| 609 | self.user_exc_info = sys.exc_info() # For testing. |
| 610 | print_exception() |
| 611 | jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>") |
| 612 | if jit: |
| 613 | self.rpchandler.interp.open_remote_stack_viewer() |
| 614 | else: |
| 615 | flush_stdout() |
| 616 | |
| 617 | def interrupt_the_server(self): |
| 618 | if interruptible: |
| 619 | thread.interrupt_main() |
| 620 | |
| 621 | def start_the_debugger(self, gui_adap_oid): |
| 622 | return debugger_r.start_debugger(self.rpchandler, gui_adap_oid) |
| 623 | |
| 624 | def stop_the_debugger(self, idb_adap_oid): |
| 625 | "Unregister the Idb Adapter. Link objects and Idb then subject to GC" |
| 626 | self.rpchandler.unregister(idb_adap_oid) |
| 627 | |
| 628 | def get_the_calltip(self, name): |
| 629 | return self.calltip.fetch_tip(name) |
| 630 |
no outgoing calls
no test coverage detected
searching dependent graphs…