-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
trace
: line tracing output lacks newlines if source lines are not available
#103956
Comments
serhiy-storchaka
pushed a commit
that referenced
this issue
May 9, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 9, 2024
…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>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 9, 2024
…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>
This was referenced May 9, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 9, 2024
…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>
serhiy-storchaka
pushed a commit
that referenced
this issue
May 9, 2024
serhiy-storchaka
pushed a commit
that referenced
this issue
May 9, 2024
SonicField
pushed a commit
to SonicField/cpython
that referenced
this issue
May 9, 2024
…ythonGH-103958) Print only filename with lineno if linecache.getline() returns an empty string.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
trace
doesn't print newline character when handling line event if it can't fetch source line that corresponds to a current frame, e. g. in case of frozen modules (or in any other case whenframe.f_code.co_filename
points to a non-existing file).Example:
It happens because
Trace
object'slocaltrace_trace
andlocaltrace_trace_and_count
methods expect the call tolinecache.getline
to always return source line with newline at the end of it.cpython/Lib/trace.py
Lines 566 to 577 in bf0b8a9
Confirmed on 3.11.1 and 3.12.0a7+(63842bd).
I'll do a PR with possible fix.
Linked PRs
trace
output in case of missing source line #103958trace
output in case of missing source line (GH-103958) #118832trace
output in case of missing source line (GH-103958) #118833trace
output in case of missing source line (GH-103958) #118834The text was updated successfully, but these errors were encountered: