Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Oct 7, 2023
1 parent 1fc7abe commit 5180c96
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pydevd-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install common Python deps
run: |
pip install --upgrade pip
pip install wheel cython psutil twine --no-warn-script-location
pip install wheel cython setuptools psutil twine --no-warn-script-location
- name: Build cython
env:
Expand Down
14 changes: 11 additions & 3 deletions _pydevd_bundle/pydevd_collect_bytecode_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def collect_return_info(co, use_func_first_line=False):
op_offset_to_line = dict(dis.findlinestarts(co))
for instruction in iter_instructions(co):
curr_op_name = instruction.opname
if curr_op_name == 'RETURN_VALUE':
if curr_op_name in ('RETURN_VALUE', 'RETURN_CONST'):
lst.append(ReturnInfo(_get_line(op_offset_to_line, instruction.offset, firstlineno, search=True)))

return lst
Expand Down Expand Up @@ -552,6 +552,11 @@ def __init__(self, line, tok):
self.line = line
self.tok = tok

def __str__(self) -> str:
return '_MsgPart(line: %s tok: %s)' % (self.line, self.tok)

__repr__ = __str__

@classmethod
def add_to_line_to_contents(cls, obj, line_to_contents, line=None):
if isinstance(obj, (list, tuple)):
Expand Down Expand Up @@ -669,7 +674,7 @@ def _lookahead(self):
)
return RESTART_FROM_LOOKAHEAD

if next_instruction.opname in ('CALL_FUNCTION', 'PRECALL'):
if next_instruction.opname in ('CALL_FUNCTION', 'PRECALL', 'CALL'):
if len(found) == next_instruction.argval + 1:
force_restart = False
delta = 0
Expand Down Expand Up @@ -804,9 +809,12 @@ def _next_instruction_to_str(self, line_to_contents):

instruction = self.instructions.pop(0)

if instruction.opname in 'RESUME':
if instruction.opname in ('RESUME', 'NULL'):
return None

if instruction.opname == 'RETURN_CONST':
return (msg(instruction, 'return ', line=self.min_line(instruction)), msg(instruction))

if instruction.opname in ('LOAD_GLOBAL', 'LOAD_FAST', 'LOAD_CONST', 'LOAD_NAME'):
next_instruction = self.instructions[0]
if next_instruction.opname in ('STORE_FAST', 'STORE_NAME'):
Expand Down
4 changes: 2 additions & 2 deletions tests_python/test_collect_bytecode_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def check(self, method, expected_as_str, expected_as_str_source_version=None, up
if update_try_except_infos is not None:
update_try_except_infos(try_except_infos)

if sys.version_info[:2] not in ((3, 10), (3, 11)):
if sys.version_info[:2] not in ((3, 10), (3, 11), (3, 12)):
assert str(try_except_infos) == expected_as_str
from _pydevd_bundle.pydevd_collect_bytecode_info import collect_try_except_info_from_source

Expand Down Expand Up @@ -193,7 +193,7 @@ def test_collect_try_except_info(data_regression, pyfile):
info = collect_try_except_info(method.__code__, use_func_first_line=True)
method_to_info[key] = sorted(str(x) for x in info)

if sys.version_info[:2] not in ((3, 10), (3, 11)):
if sys.version_info[:2] not in ((3, 10), (3, 11), (3, 12)):
data_regression.check(method_to_info)

data_regression.check(method_to_info_from_source)
Expand Down

0 comments on commit 5180c96

Please sign in to comment.