]> granicus.if.org Git - python/commitdiff
Issue #20363. Fixed BytesWarning triggerred by test suite.
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 6 Feb 2014 20:49:45 +0000 (22:49 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 6 Feb 2014 20:49:45 +0000 (22:49 +0200)
Patch by Berker Peksag.

Lib/configparser.py
Lib/distutils/command/register.py
Lib/test/test_hash.py

index aa401fc0a337fa7cc8e64c485296dcc96ecaf199..aebf8a0fb90243cdca9b2739867971aed4ed9fcd 100644 (file)
@@ -286,7 +286,7 @@ class ParsingError(Error):
             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 @@ class MissingSectionHeaderError(ParsingError):
     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
index 55656c23538836074a3a31a0a810003cd6f64bed..b49f86fe5814240641db8a5ab54e209a7eb709ef 100644 (file)
@@ -300,5 +300,5 @@ Your selection [default 1]: ''', log.INFO)
             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
index e3ab6e4385a9f9d14b7370c6f4654507678aaf3e..22ebbccb22d2ad665f6959cfede3429392e84034 100644 (file)
@@ -138,7 +138,7 @@ class HashRandomizationTests:
     # an object to be tested
 
     def get_hash_command(self, repr_):
-        return 'print(hash(%s))' % repr_
+        return 'print(hash(eval(%a)))' % repr_
 
     def get_hash(self, repr_, seed=None):
         env = os.environ.copy()