Skip to content

Commit e726d83

Browse files
committed
Add closing ">" in frame and code formatting
1 parent 34edb7c commit e726d83

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

trepan/lib/chdir.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copied from 3.11
2+
"""Utilities for with-statement contexts. See PEP 343."""
3+
4+
class ChDir(object):
5+
"""
6+
Step into a directory temporarily.
7+
"""
8+
def __init__(self, path):
9+
self.old_dir = os.getcwd()
10+
self.new_dir = path
11+
12+
def __enter__(self):
13+
os.chdir(self.new_dir)
14+
15+
def __exit__(self, *args):
16+
os.chdir(self.old_dir)

trepan/lib/stack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@ def __init__(self):
540540

541541
def fn(x):
542542
frame = inspect.currentframe()
543+
is_module, mess = format_function_and_parameters(frame, dd, style="tango")
544+
print(mess)
543545
print(format_stack_entry(dd, (frame, frame.f_code.co_firstlineno + 2)))
544546
print(get_call_function_name(frame))
545547
return

trepan/processor/print.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def format_code(code_object: CodeType, style) -> str:
5959
formatted_filename = format_token(Filename, code_object.co_filename, style=style)
6060
return (
6161
f"<code object {formatted_name} at {formatted_id} "
62-
f"file {formatted_filename}, line {formatted_line}"
62+
f"file {formatted_filename}, line {formatted_line}>"
6363
)
6464

6565

@@ -73,7 +73,7 @@ def format_frame(frame_object, style) -> str:
7373
formatted_filename = format_token(Filename, frame_object.f_code.co_filename, style=style)
7474
return (
7575
f"<frame at {formatted_id} "
76-
f"file {formatted_filename}, line {formatted_line}"
76+
f"file {formatted_filename}, line {formatted_line}>"
7777
)
7878

7979

0 commit comments

Comments
 (0)