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

[3.13] gh-120495: Fix incorrect exception handling in Tab Nanny (GH-120498) #120548

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions Lib/tabnanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ def check(file):
errprint("%r: Token Error: %s" % (file, msg))
return

except SyntaxError as msg:
errprint("%r: Token Error: %s" % (file, msg))
return

except IndentationError as msg:
errprint("%r: Indentation Error: %s" % (file, msg))
return

except SyntaxError as msg:
errprint("%r: Syntax Error: %s" % (file, msg))
return

except NannyNag as nag:
badline = nag.get_lineno()
line = nag.get_line()
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_tabnanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def validate_cmd(self, *args, stdout="", stderr="", partial=False, expect_failur
def test_with_errored_file(self):
"""Should displays error when errored python file is given."""
with TemporaryPyFile(SOURCE_CODES["wrong_indented"]) as file_path:
stderr = f"{file_path!r}: Token Error: "
stderr = f"{file_path!r}: Indentation Error: "
stderr += ('unindent does not match any outer indentation level'
' (<string>, line 3)')
self.validate_cmd(file_path, stderr=stderr, expect_failure=True)
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ Ivan Levkivskyi
Ben Lewis
William Lewis
Akira Li
Jiahao Li
Robert Li
Xuanji Li
Zekun Li
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix incorrect exception handling in Tab Nanny. Patch by Wulian233.
Loading