-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
gh-103956: fix trace
output in case of missing source line
#103958
gh-103956: fix trace
output in case of missing source line
#103958
Conversation
check if call to `linecache.getline` returns non-empty string otherwise print only filename with lineno
With this fix the output for frames with missing source files will look like this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add some tests?
It turned out that line tracing isn't tested at all. I will open a separate issue to handle it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks @chgnrdv for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
…ythonGH-103958) Print only filename with lineno if linecache.getline() returns an empty string. (cherry picked from commit 7c87ce7) Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
…ythonGH-103958) Print only filename with lineno if linecache.getline() returns an empty string. (cherry picked from commit 7c87ce7) Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
GH-118832 is a backport of this pull request to the 3.12 branch. |
GH-118833 is a backport of this pull request to the 3.11 branch. |
Thanks @chgnrdv for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…ythonGH-103958) Print only filename with lineno if linecache.getline() returns an empty string. (cherry picked from commit 7c87ce7) Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
GH-118834 is a backport of this pull request to the 3.13 branch. |
It is too late for the 3.11 backport, but it should now be backported to 3.13. |
…ythonGH-103958) Print only filename with lineno if linecache.getline() returns an empty string.
Fixes #103956
trace
: line tracing output lacks newlines if source lines are not available #103956