]> granicus.if.org Git - python/commitdiff
Bug #1458017: make distutils.Log._log more forgiving when passing in
authorGeorg Brandl <georg@python.org>
Sat, 1 Apr 2006 07:46:54 +0000 (07:46 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 1 Apr 2006 07:46:54 +0000 (07:46 +0000)
msg strings with '%', but without format args.

Lib/distutils/log.py

index cf3ee136e0ad405c7131fdb0e69429a45ef2ad12..95d4c1c5a21f0cb9041f29b7ea3caf8c8ae99278 100644 (file)
@@ -20,7 +20,12 @@ class Log:
 
     def _log(self, level, msg, args):
         if level >= self.threshold:
-            print msg % args
+            if not args:
+                # msg may contain a '%'. If args is empty,
+                # don't even try to string-format
+                print msg
+            else:
+                print msg % args
             sys.stdout.flush()
 
     def log(self, level, msg, *args):