MCPcopy Create free account
hub / github.com/bpython/bpython / __exit__

Method __exit__

bpython/curtsiesfrontend/repl.py:586–602  ·  view source on GitHub ↗
(
        self,
        exc_type: type[BaseException] | None,
        exc_val: BaseException | None,
        exc_tb: TracebackType | None,
    )

Source from the content-addressed store, hash-verified

584 return self
585
586 def __exit__(
587 self,
588 exc_type: type[BaseException] | None,
589 exc_val: BaseException | None,
590 exc_tb: TracebackType | None,
591 ) -> Literal[False]:
592 sys.stdin = self.orig_stdin
593 sys.stdout = self.orig_stdout
594 sys.stderr = self.orig_stderr
595
596 if is_main_thread():
597 # This turns off resize detection and ctrl-z suspension.
598 signal.signal(signal.SIGWINCH, self.orig_sigwinch_handler)
599 signal.signal(signal.SIGTSTP, self.orig_sigtstp_handler)
600
601 sys.meta_path = self.orig_meta_path
602 return False
603
604 def sigwinch_handler(self, signum: int, frame: FrameType | None) -> None:
605 old_rows, old_columns = self.height, self.width

Callers 1

sigtstp_handlerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected