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

Tracebacks get confusing when an error happens outside docstring #36

Closed
freider opened this issue Nov 27, 2024 · 2 comments · Fixed by #39
Closed

Tracebacks get confusing when an error happens outside docstring #36

freider opened this issue Nov 27, 2024 · 2 comments · Fixed by #39

Comments

@freider
Copy link
Collaborator

freider commented Nov 27, 2024

If an exception is raised by code in the same file but outside of a docstring (e.g. calling a function that's defined in the same file), the traceback gets confusing and states "code block line XX*" and can for some reason not necessarily extract the correct line (or any line) to display in the traceback.

One possible fix could be to offset the docstring tests similarly to how they are offset in the source file before eval-running them, by inserting a bunch of blank newlines before them. I think that would let us use the default traceback extraction code or at least use the source file as is for the source of truth for source code extraction

@freider
Copy link
Collaborator Author

freider commented Nov 27, 2024

Even more confusing: if there are lines within such a traceback that originating in other files, they also get incorrect line numbers...

@freider
Copy link
Collaborator Author

freider commented Nov 28, 2024

Fix for the most urgent part of this (crash in traceback generation): #37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant