/usr/lib/python3/dist-packages/ipdb/stdout.py is in python3-ipdb 0.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import sys
from contextlib import contextmanager
from IPython.utils import io
from .__main__ import set_trace
from .__main__ import post_mortem
def update_stdout():
# setup stdout to ensure output is available with nose
io.stdout = sys.stdout = sys.__stdout__
def sset_trace(frame=None, context=3):
update_stdout()
if frame is None:
frame = sys._getframe().f_back
set_trace(frame, context)
def spost_mortem(tb=None):
update_stdout()
post_mortem(tb)
def spm():
spost_mortem(sys.last_traceback)
@contextmanager
def slaunch_ipdb_on_exception():
try:
yield
except Exception:
e, m, tb = sys.exc_info()
print(m.__repr__(), file=sys.stderr)
spost_mortem(tb)
finally:
pass
|