Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiline linenos for Python3.7 #132

Merged
merged 36 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a8a90d1
Preliminary trial of lineno in value stack
victorjzsun May 16, 2021
4702f8f
Fixed more opcodes with linenos
victorjzsun May 30, 2021
b314de6
Small fixes
victorjzsun Aug 25, 2021
f9b0d60
Change Value to StackItem
victorjzsun Oct 12, 2021
ef3ad7c
Fix bugs and refactor code
victorjzsun Oct 12, 2021
57724e0
Merge branch 'master' into fix-multiline
victorjzsun Oct 16, 2021
cccd364
Fix more bugs
victorjzsun Oct 29, 2021
46bfd04
Merge branch 'master' into fix-multiline
victorjzsun Oct 29, 2021
4e205d9
Fix py37 bugs
victorjzsun Oct 31, 2021
6cf49eb
Compute lineno from offset rather than using instr's lineno
victorjzsun Nov 1, 2021
0aa7dc6
Handle offset 0 cases
victorjzsun Nov 1, 2021
ad98708
Try to fix spacing
victorjzsun Nov 2, 2021
a4e0e16
Revert last commit
victorjzsun Nov 2, 2021
7e662f0
modify conftest
laike9m Oct 16, 2021
2d19bd1
remove lint in js pretest
laike9m Nov 2, 2021
d851a27
Cleanup code
victorjzsun Nov 12, 2021
f668a73
Remove extra check
victorjzsun Nov 12, 2021
429d621
Use try-import instead of pkg_resources
victorjzsun Nov 21, 2021
64d9b3e
Resolve merge from master
victorjzsun Nov 21, 2021
e99bc8e
Remove extra check
victorjzsun Nov 21, 2021
bf039bc
Remove more unnecessary code
victorjzsun Nov 23, 2021
84029d3
Merge _push_stackitem into _push
victorjzsun Nov 23, 2021
e3c5b5a
Use event lineno for other events too
victorjzsun Nov 23, 2021
0201b98
Make miscellaneous changes
victorjzsun Nov 23, 2021
b8c167e
Simplify custom_values
victorjzsun Nov 23, 2021
4c70620
Use is_custom attribute to be more explicit
victorjzsun Nov 24, 2021
77546ff
Fix exception handlers
victorjzsun Nov 25, 2021
cf3b9c6
Use two classes
victorjzsun Nov 28, 2021
e2014f4
Formatting
victorjzsun Nov 28, 2021
8093578
Merge branch 'master' into fix-multiline
victorjzsun Nov 28, 2021
cbe3ee9
Rename classes
victorjzsun Dec 5, 2021
5e2c3b6
Simplify _push, formatting, and more docs
victorjzsun Dec 31, 2021
310f168
Merge master
victorjzsun Jan 2, 2022
9c2500e
Move _placeholder into class
victorjzsun Jan 2, 2022
b8d48a7
Fix lineno
victorjzsun Jan 2, 2022
7439987
Fix loop lineno in frame
victorjzsun Jan 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cyberbrain/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def log_return_event(self, frame: FrameType, value: Any):
lineno=self.offset_to_lineno[frame.f_lasti],
filename=self.filename,
offset=frame.f_lasti,
sources=set(utils.flatten(self.value_stack._pop())),
sources=set(self.value_stack._pop().sources),
index=len(self.events),
)
)
Expand Down Expand Up @@ -204,6 +204,7 @@ def log_events(
jumped=jumped,
exc_info=exc_info,
snapshot=self.latest_snapshot,
lineno=self.offset_to_lineno[instr.offset],
)
if not event_info:
return
Expand All @@ -225,7 +226,7 @@ def log_events(
value=json,
repr=utils.get_repr(value),
filename=self.filename,
lineno=self.offset_to_lineno[instr.offset],
lineno=event_info.lineno,
sources=event_info.sources,
offset=instr.offset,
)
Expand All @@ -239,7 +240,7 @@ def log_events(
repr=utils.get_repr(value),
sources=event_info.sources,
filename=self.filename,
lineno=self.offset_to_lineno[instr.offset],
lineno=event_info.lineno,
offset=instr.offset,
)
)
Expand All @@ -248,7 +249,7 @@ def log_events(
Deletion(
target=target,
filename=self.filename,
lineno=self.offset_to_lineno[instr.offset],
lineno=event_info.lineno,
offset=instr.offset,
)
)
Expand Down
6 changes: 5 additions & 1 deletion cyberbrain/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ def stop(self):
del self.raw_frame
# Checks the value stack is in correct state: no extra elements left on
# stack.These two are tracers replaced with placeholders.
assert self.frame_logger.frame.value_stack.stack == [[], []]
assert (
self.frame_logger.frame.value_stack.stack_level == 2
and self.frame_logger.frame.value_stack.tos.sources == []
and self.frame_logger.frame.value_stack.tos1.sources == []
)
else:
assert len(self.frame_logger.frame.value_stack.stack) == 0

Expand Down
Loading