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

add fix for import tracker compatibility with py3.11 #75

Merged
merged 4 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions import_tracker/import_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,10 @@ def _get_value_col(dis_line: str) -> str:
def _get_op_number(dis_line: str) -> Optional[int]:
"""Get the opcode number out of the line of `dis` output"""
line_parts = dis_line.split()
if not line_parts:
valid_line_part_idxs = [i for i, val in enumerate(line_parts) if val.isupper()]
if not valid_line_part_idxs:
return None
opcode_idx = min([i for i, val in enumerate(line_parts) if val.isupper()])
opcode_idx = min(valid_line_part_idxs)
assert opcode_idx > 0, f"Opcode found at the beginning of line! [{dis_line}]"
return int(line_parts[opcode_idx - 1])

Expand Down
Loading