mirror of
https://github.com/python/cpython.git
synced 2024-11-23 01:45:25 +08:00
gh-120495: Fix incorrect exception handling in Tab Nanny (#120498)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
42ebdd83bb
commit
c501261c91
@ -105,14 +105,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()
|
||||
|
@ -315,7 +315,7 @@ class TestCommandLine(TestCase):
|
||||
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)
|
||||
|
@ -1099,6 +1099,7 @@ Ivan Levkivskyi
|
||||
Ben Lewis
|
||||
William Lewis
|
||||
Akira Li
|
||||
Jiahao Li
|
||||
Robert Li
|
||||
Xuanji Li
|
||||
Zekun Li
|
||||
|
@ -0,0 +1 @@
|
||||
Fix incorrect exception handling in Tab Nanny. Patch by Wulian233.
|
Loading…
Reference in New Issue
Block a user