Save the state of hooks in the sys module. This has to be called after self.user_module is created.
(self)
| 949 | #------------------------------------------------------------------------- |
| 950 | |
| 951 | def save_sys_module_state(self): |
| 952 | """Save the state of hooks in the sys module. |
| 953 | |
| 954 | This has to be called after self.user_module is created. |
| 955 | """ |
| 956 | self._orig_sys_module_state = {'stdin': sys.stdin, |
| 957 | 'stdout': sys.stdout, |
| 958 | 'stderr': sys.stderr, |
| 959 | 'excepthook': sys.excepthook} |
| 960 | self._orig_sys_modules_main_name = self.user_module.__name__ |
| 961 | self._orig_sys_modules_main_mod = sys.modules.get(self.user_module.__name__) |
| 962 | |
| 963 | def restore_sys_module_state(self): |
| 964 | """Restore the state of the sys module.""" |