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 type error in traceback formatter #172

Closed
1 task done
ecalifornica opened this issue May 9, 2024 · 1 comment
Closed
1 task done

Fix type error in traceback formatter #172

ecalifornica opened this issue May 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ecalifornica
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

mypy check failing due to a mismatch between signature and return type. Looks like the return value can be removed, as the only call to the function expects an iterable, matching the function signature.

Error:

python -m mypy src/pystack --strict --ignore-missing-imports
src/pystack/traceback_formatter.py:113: error: No return value expected  [return-value]
Found 1 error in 1 file (checked 11 source files)

Relevant function:

def _format_merged_stacks(
thread: PyThread, current_frame: Optional[PyFrame]
) -> Iterable[str]:
for frame in thread.native_frames:
if frame_type(frame, thread.python_version) == NativeFrame.FrameType.EVAL:
assert current_frame is not None
yield from format_frame(current_frame)
current_frame = current_frame.next
while current_frame and not current_frame.is_entry:
yield from format_frame(current_frame)
current_frame = current_frame.next
continue
elif frame_type(frame, thread.python_version) == NativeFrame.FrameType.IGNORE:
continue
elif frame_type(frame, thread.python_version) == NativeFrame.FrameType.OTHER:
function = colored(frame.symbol, "yellow")
yield (
f' {colored("(C)", "blue")} File "{frame.path}",'
f" line {frame.linenumber},"
f" in {function} ({colored(frame.library, attrs=['faint'])})"
)
else: # pragma: no cover
raise ValueError(
f"Invalid frame type: {frame_type(frame, thread.python_version)}"
)
return current_frame

Usage:

yield from _format_merged_stacks(thread, current_frame)

Expected Behavior

No CI failure.

Steps To Reproduce

  1. In development container.
  2. Run make lint

Pystack Version

1.3.0

Python Version

3.12

Linux distribution

Ubuntu

Anything else?

No response

@ecalifornica ecalifornica added the bug Something isn't working label May 9, 2024
@ecalifornica
Copy link
Author

Fixed by #175

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant