def save_sys_module_state(self):
    'Save the state of hooks in the sys module.\n\n        This has to be called after self.user_module is created.\n        '
    self._orig_sys_module_state = {'stdin': sys.stdin, 'stdout': sys.stdout, 'stderr': sys.stderr, 'excepthook': sys.excepthook}
    self._orig_sys_modules_main_name = self.user_module.__name__
    self._orig_sys_modules_main_mod = sys.modules.get(self.user_module.__name__)
Save the state of hooks in the sys module.

This has to be called after self.user_module is created.
def save_sys_module_state(self):
    'Save the state of hooks in the sys module.\n\n        This has to be called after self.user_module is created.\n        '
    self._orig_sys_module_state = {'stdin': sys.stdin, 'stdout': sys.stdout, 'stderr': sys.stderr, 'excepthook': sys.excepthook}
    self._orig_sys_modules_main_name = self.user_module.__name__
    self._orig_sys_modules_main_mod = sys.modules.get(self.user_module.__name__)