| 2566 | return None |
| 2567 | |
| 2568 | def _run(self, target: _ExecutableTarget): |
| 2569 | # When bdb sets tracing, a number of call and line events happen |
| 2570 | # BEFORE debugger even reaches user's code (and the exact sequence of |
| 2571 | # events depends on python version). Take special measures to |
| 2572 | # avoid stopping before reaching the main script (see user_line and |
| 2573 | # user_call for details). |
| 2574 | self._wait_for_mainpyfile = True |
| 2575 | self._user_requested_quit = False |
| 2576 | |
| 2577 | self.mainpyfile = self.canonic(target.filename) |
| 2578 | |
| 2579 | # The target has to run in __main__ namespace (or imports from |
| 2580 | # __main__ will break). Clear __main__ and replace with |
| 2581 | # the target namespace. |
| 2582 | import __main__ |
| 2583 | __main__.__dict__.clear() |
| 2584 | __main__.__dict__.update(target.namespace) |
| 2585 | |
| 2586 | # Clear the mtime table for program reruns, assume all the files |
| 2587 | # are up to date. |
| 2588 | self._file_mtime_table.clear() |
| 2589 | |
| 2590 | self.run(target.code) |
| 2591 | |
| 2592 | def _format_exc(self, exc: BaseException): |
| 2593 | return traceback.format_exception_only(exc)[-1].strip() |