Skip to content

Commit

Permalink
should match to old
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorpela committed Oct 13, 2022
1 parent b3f90ff commit 8359651
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
6 changes: 5 additions & 1 deletion overrides/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,23 @@ def _get_base_classes(frame, namespace):
def _get_base_class_names(frame) -> List[List[str]]:
"""Get baseclass names from the code object"""
extends: List[Tuple[str, str]] = []
add_last_step = True
for instruction in dis.get_instructions(frame.f_code):
if instruction.offset > frame.f_lasti:
break
if instruction.opcode not in dis.hasname:
continue
if not add_last_step:
extends = []
add_last_step = True
if instruction.opname == "LOAD_NAME":
extends.append(("name", instruction.argval))
elif instruction.opname == "LOAD_ATTR":
extends.append(("attr", instruction.argval))
elif instruction.opname == "LOAD_GLOBAL":
extends.append(("name", instruction.argval))
else:
extends = []
add_last_step = False

items: List[List[str]] = []
previous_item: List[str] = []
Expand Down
12 changes: 0 additions & 12 deletions tests/test_get_base_class_names.py

This file was deleted.

0 comments on commit 8359651

Please sign in to comment.