Save the state of hooks in the sys module. This has to be called after self.user_module is created.
(self)
| 996 | #------------------------------------------------------------------------- |
| 997 | |
| 998 | def save_sys_module_state(self): |
| 999 | """Save the state of hooks in the sys module. |
| 1000 | |
| 1001 | This has to be called after self.user_module is created. |
| 1002 | """ |
| 1003 | self._orig_sys_module_state = {'stdin': sys.stdin, |
| 1004 | 'stdout': sys.stdout, |
| 1005 | 'stderr': sys.stderr, |
| 1006 | 'excepthook': sys.excepthook} |
| 1007 | self._orig_sys_modules_main_name = self.user_module.__name__ |
| 1008 | self._orig_sys_modules_main_mod = sys.modules.get(self.user_module.__name__) |
| 1009 | |
| 1010 | def restore_sys_module_state(self): |
| 1011 | """Restore the state of the sys module.""" |