diff --git a/README.md b/README.md index 600112e..68bfbff 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![CI](https://github.com/samuelcolvin/python-devtools/workflows/CI/badge.svg?event=push)](https://github.com/samuelcolvin/python-devtools/actions?query=event%3Apush+branch%3Amaster+workflow%3ACI) [![Coverage](https://codecov.io/gh/samuelcolvin/python-devtools/branch/master/graph/badge.svg)](https://codecov.io/gh/samuelcolvin/python-devtools) -[![pypi](https://img.shields.io/pypi/v/python-devtools.svg)](https://pypi.python.org/pypi/python-devtools) -[![versions](https://img.shields.io/pypi/pyversions/python-devtools.svg)](https://github.com/samuelcolvin/python-devtools) +[![pypi](https://img.shields.io/pypi/v/devtools.svg)](https://pypi.python.org/pypi/python-devtools) +[![versions](https://img.shields.io/pypi/pyversions/devtools.svg)](https://github.com/samuelcolvin/python-devtools) [![license](https://img.shields.io/github/license/samuelcolvin/python-devtools.svg)](https://github.com/samuelcolvin/python-devtools/blob/master/LICENSE) **Python's missing debug print command and other development tools.** diff --git a/devtools/debug.py b/devtools/debug.py index 480f070..4155b3a 100644 --- a/devtools/debug.py +++ b/devtools/debug.py @@ -310,12 +310,12 @@ def _statement_range(call_frame: 'FrameType', func_name: str) -> 'Tuple[int, int last_line = None for instr in instructions: # pragma: no branch - if instr.starts_line: - if instr.opname in {'LOAD_GLOBAL', 'LOAD_NAME'} and instr.argval == func_name: - first_line = instr.starts_line - elif instr.opname == 'LOAD_GLOBAL' and instr.argval == 'debug': - if next(instructions).argval == func_name: - first_line = instr.starts_line + if ( + instr.starts_line + and instr.opname in {'LOAD_GLOBAL', 'LOAD_NAME'} + and (instr.argval == func_name or (instr.argval == 'debug' and next(instructions).argval == func_name)) + ): + first_line = instr.starts_line if instr.offset == call_frame.f_lasti: break