| 1537 | return None |
| 1538 | |
| 1539 | def _runmodule(self, module_name): |
| 1540 | self._wait_for_mainpyfile = True |
| 1541 | self._user_requested_quit = False |
| 1542 | import runpy |
| 1543 | mod_name, mod_spec, code = runpy._get_module_details(module_name) |
| 1544 | self.mainpyfile = self.canonic(code.co_filename) |
| 1545 | import __main__ |
| 1546 | __main__.__dict__.clear() |
| 1547 | __main__.__dict__.update({ |
| 1548 | "__name__": "__main__", |
| 1549 | "__file__": self.mainpyfile, |
| 1550 | "__package__": mod_spec.parent, |
| 1551 | "__loader__": mod_spec.loader, |
| 1552 | "__spec__": mod_spec, |
| 1553 | "__builtins__": __builtins__, |
| 1554 | }) |
| 1555 | self.run(code) |
| 1556 | |
| 1557 | def _runscript(self, filename): |
| 1558 | # The script has to run in __main__ namespace (or imports from |