[Python-checkins] cpython (merge 3.3 -> default): Issue #20363. Fixed BytesWarning triggerred by test suite.

serhiy.storchaka python-checkins at python.org
Thu Feb 6 21:57:18 CET 2014


http://hg.python.org/cpython/rev/a4431dce107a
changeset:   89001:a4431dce107a
parent:      88999:775fb736b4b8
parent:      89000:791674a74e47
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Feb 06 22:52:23 2014 +0200
summary:
  Issue #20363. Fixed BytesWarning triggerred by test suite.
Patch by Berker Peksag.

files:
  Lib/base64.py                     |  2 +-
  Lib/configparser.py               |  4 ++--
  Lib/distutils/command/register.py |  2 +-
  Lib/test/test_hash.py             |  2 +-
  4 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Lib/base64.py b/Lib/base64.py
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -362,7 +362,7 @@
     if adobe:
         if not (b.startswith(_A85START) and b.endswith(_A85END)):
             raise ValueError("Ascii85 encoded byte sequences must be bracketed "
-                             "by {} and {}".format(_A85START, _A85END))
+                             "by {!r} and {!r}".format(_A85START, _A85END))
         b = b[2:-2] # Strip off start/end markers
     #
     # We have to go through this stepwise, so as to ignore spaces and handle
diff --git a/Lib/configparser.py b/Lib/configparser.py
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -286,7 +286,7 @@
             raise ValueError("Required argument `source' not given.")
         elif filename:
             source = filename
-        Error.__init__(self, 'Source contains parsing errors: %s' % source)
+        Error.__init__(self, 'Source contains parsing errors: %r' % source)
         self.source = source
         self.errors = []
         self.args = (source, )
@@ -322,7 +322,7 @@
     def __init__(self, filename, lineno, line):
         Error.__init__(
             self,
-            'File contains no section headers.\nfile: %s, line: %d\n%r' %
+            'File contains no section headers.\nfile: %r, line: %d\n%r' %
             (filename, lineno, line))
         self.source = filename
         self.lineno = lineno
diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py
--- a/Lib/distutils/command/register.py
+++ b/Lib/distutils/command/register.py
@@ -300,5 +300,5 @@
             result = 200, 'OK'
         if self.show_response:
             dashes = '-' * 75
-            self.announce('%s%s%s' % (dashes, data, dashes))
+            self.announce('%s%r%s' % (dashes, data, dashes))
         return result
diff --git a/Lib/test/test_hash.py b/Lib/test/test_hash.py
--- a/Lib/test/test_hash.py
+++ b/Lib/test/test_hash.py
@@ -172,7 +172,7 @@
     # an object to be tested
 
     def get_hash_command(self, repr_):
-        return 'print(hash(eval(%r.decode("utf-8"))))' % repr_.encode("utf-8")
+        return 'print(hash(eval(%a)))' % repr_
 
     def get_hash(self, repr_, seed=None):
         env = os.environ.copy()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list