Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aa7bcc3

Browse files
committed
Update Lib/tokenize.py
1 parent e81810d commit aa7bcc3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Lib/test/test_tabnanny.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def test_when_nannynag_error_verbose(self):
222222
"""
223223
with TemporaryPyFile(SOURCE_CODES["nannynag_errored"]) as file_path:
224224
out = f"{file_path!r}: *** Line 3: trouble in tab city! ***\n"
225-
out += "offending line: '\\tprint(\"world\")\\n'\n"
225+
out += "offending line: '\\tprint(\"world\")'\n"
226226
out += "inconsistent use of tabs and spaces in indentation\n"
227227

228228
tabnanny.verbose = 1
@@ -231,7 +231,7 @@ def test_when_nannynag_error_verbose(self):
231231
def test_when_nannynag_error(self):
232232
"""A python source code file eligible for raising `tabnanny.NannyNag`."""
233233
with TemporaryPyFile(SOURCE_CODES["nannynag_errored"]) as file_path:
234-
out = f"{file_path} 3 '\\tprint(\"world\")\\n'\n"
234+
out = f"{file_path} 3 '\\tprint(\"world\")'\n"
235235
self.verify_tabnanny_check(file_path, out=out)
236236

237237
def test_when_no_file(self):
@@ -341,14 +341,14 @@ def test_verbose_mode(self):
341341
"""Should display more error information if verbose mode is on."""
342342
with TemporaryPyFile(SOURCE_CODES["nannynag_errored"]) as path:
343343
stdout = textwrap.dedent(
344-
"offending line: '\\tprint(\"world\")\\n'"
344+
"offending line: '\\tprint(\"world\")'"
345345
).strip()
346346
self.validate_cmd("-v", path, stdout=stdout, partial=True)
347347

348348
def test_double_verbose_mode(self):
349349
"""Should display detailed error information if double verbose is on."""
350350
with TemporaryPyFile(SOURCE_CODES["nannynag_errored"]) as path:
351351
stdout = textwrap.dedent(
352-
"offending line: '\\tprint(\"world\")\\n'"
352+
"offending line: '\\tprint(\"world\")'"
353353
).strip()
354354
self.validate_cmd("-vv", path, stdout=stdout, partial=True)

Lib/tokenize.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ def error(message, filename=None, location=None):
518518
if args.exact:
519519
token_type = token.exact_type
520520
token_range = "%d,%d-%d,%d:" % (token.start + token.end)
521-
print("%-20s%-15s%-15r%-15r" %
522-
(token_range, tok_name[token_type], token.string, token.line))
521+
print("%-20s%-15s%-15r" %
522+
(token_range, tok_name[token_type], token.string))
523523
except IndentationError as err:
524524
line, column = err.args[1][1:3]
525525
error(err.args[0], filename, (line, column))

0 commit comments

Comments
 (0)