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

Skip to content

Commit a26b3f1

Browse files
Issue #20363. Fixed BytesWarning triggerred by test suite.
Patch by Berker Peksag.
2 parents a146bef + bc27a05 commit a26b3f1

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

Lib/base64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'):
362362
if adobe:
363363
if not (b.startswith(_A85START) and b.endswith(_A85END)):
364364
raise ValueError("Ascii85 encoded byte sequences must be bracketed "
365-
"by {} and {}".format(_A85START, _A85END))
365+
"by {!r} and {!r}".format(_A85START, _A85END))
366366
b = b[2:-2] # Strip off start/end markers
367367
#
368368
# We have to go through this stepwise, so as to ignore spaces and handle

Lib/configparser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def __init__(self, source=None, filename=None):
286286
raise ValueError("Required argument `source' not given.")
287287
elif filename:
288288
source = filename
289-
Error.__init__(self, 'Source contains parsing errors: %s' % source)
289+
Error.__init__(self, 'Source contains parsing errors: %r' % source)
290290
self.source = source
291291
self.errors = []
292292
self.args = (source, )
@@ -322,7 +322,7 @@ class MissingSectionHeaderError(ParsingError):
322322
def __init__(self, filename, lineno, line):
323323
Error.__init__(
324324
self,
325-
'File contains no section headers.\nfile: %s, line: %d\n%r' %
325+
'File contains no section headers.\nfile: %r, line: %d\n%r' %
326326
(filename, lineno, line))
327327
self.source = filename
328328
self.lineno = lineno

Lib/distutils/command/register.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,5 @@ def post_to_server(self, data, auth=None):
300300
result = 200, 'OK'
301301
if self.show_response:
302302
dashes = '-' * 75
303-
self.announce('%s%s%s' % (dashes, data, dashes))
303+
self.announce('%s%r%s' % (dashes, data, dashes))
304304
return result

Lib/test/test_hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class HashRandomizationTests:
172172
# an object to be tested
173173

174174
def get_hash_command(self, repr_):
175-
return 'print(hash(eval(%r.decode("utf-8"))))' % repr_.encode("utf-8")
175+
return 'print(hash(eval(%a)))' % repr_
176176

177177
def get_hash(self, repr_, seed=None):
178178
env = os.environ.copy()

0 commit comments

Comments
 (0)