8000 bpo-40585: Normalize errors messages in codeop when comparing them by pablogsal · Pull Request #20030 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40585: Normalize errors messages in codeop when comparing them #20030

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

Merged
merged 4 commits into from
May 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! fixup! bpo-40585: Normalize errors messages in codeop when com…
…paring them
  • Loading branch information
pablogsal committed May 11, 2020
commit 066daa19d11b160fa85d619ecfaede133fa3aae3
6 changes: 3 additions & 3 deletions Parser/pegen/pegen.c
Original file line number Diff line number Diff line change
6906 Expand Up @@ -310,12 +310,12 @@ get_error_line(char *buffer, int is_file)
newline = strchr(buffer, '\n');
}

while (newline && *newline == '\n') {
newline -= 1;
while (is_file && newline > buffer && newline[-1] == '\n') {
--newline;
}

if (newline) {
return PyUnicode_DecodeUTF8(buffer, newline - buffer + 1, "replace");
return PyUnicode_DecodeUTF8(buffer, newline - buffer, "replace");
}
else {
return PyUnicode_DecodeUTF8(buffer, strlen(buffer), "replace");
Expand Down
0