[Python-checkins] r43529 - python/trunk/Lib/distutils/log.py

georg.brandl python-checkins at python.org
Sat Apr 1 09:46:54 CEST 2006


Author: georg.brandl
Date: Sat Apr  1 09:46:54 2006
New Revision: 43529

Modified:
   python/trunk/Lib/distutils/log.py
Log:
Bug #1458017: make distutils.Log._log more forgiving when passing in
msg strings with '%', but without format args.


Modified: python/trunk/Lib/distutils/log.py
==============================================================================
--- python/trunk/Lib/distutils/log.py	(original)
+++ python/trunk/Lib/distutils/log.py	Sat Apr  1 09:46:54 2006
@@ -20,7 +20,12 @@
 
     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):


More information about the Python-checkins mailing list