[Python-checkins] r75000 - in python/branches/release31-maint: Lib/distutils/dist.py Lib/distutils/log.py Lib/distutils/tests/support.py Lib/distutils/tests/test_dist.py Misc/NEWS

tarek.ziade python-checkins at python.org
Mon Sep 21 15:59:08 CEST 2009


Author: tarek.ziade
Date: Mon Sep 21 15:59:07 2009
New Revision: 75000

Log:
Merged revisions 74999 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r74999 | tarek.ziade | 2009-09-21 15:55:19 +0200 (Mon, 21 Sep 2009) | 13 lines
  
  Merged revisions 74994,74997 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r74994 | tarek.ziade | 2009-09-21 15:41:08 +0200 (Mon, 21 Sep 2009) | 1 line
    
    #6954: Fixed crash when using DISTUTILS_DEBUG flag in Distutils.
  ........
    r74997 | tarek.ziade | 2009-09-21 15:49:57 +0200 (Mon, 21 Sep 2009) | 1 line
    
    forgot to commit a file in previous commit (r74994, issue #6954)
  ........
................


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Lib/distutils/dist.py
   python/branches/release31-maint/Lib/distutils/log.py
   python/branches/release31-maint/Lib/distutils/tests/support.py
   python/branches/release31-maint/Lib/distutils/tests/test_dist.py
   python/branches/release31-maint/Misc/NEWS

Modified: python/branches/release31-maint/Lib/distutils/dist.py
==============================================================================
--- python/branches/release31-maint/Lib/distutils/dist.py	(original)
+++ python/branches/release31-maint/Lib/distutils/dist.py	Mon Sep 21 15:59:07 2009
@@ -354,7 +354,7 @@
         parser = ConfigParser()
         for filename in filenames:
             if DEBUG:
-                self.announce("  reading", filename)
+                self.announce("  reading %s" % filename)
             parser.read(filename)
             for section in parser.sections():
                 options = parser.options(section)

Modified: python/branches/release31-maint/Lib/distutils/log.py
==============================================================================
--- python/branches/release31-maint/Lib/distutils/log.py	(original)
+++ python/branches/release31-maint/Lib/distutils/log.py	Mon Sep 21 15:59:07 2009
@@ -17,6 +17,9 @@
         self.threshold = threshold
 
     def _log(self, level, msg, args):
+        if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
+            raise ValueError('%s wrong log level' % str(level))
+
         if level >= self.threshold:
             if args:
                 msg = msg % args

Modified: python/branches/release31-maint/Lib/distutils/tests/support.py
==============================================================================
--- python/branches/release31-maint/Lib/distutils/tests/support.py	(original)
+++ python/branches/release31-maint/Lib/distutils/tests/support.py	Mon Sep 21 15:59:07 2009
@@ -4,6 +4,7 @@
 import tempfile
 
 from distutils import log
+from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL
 from distutils.core import Distribution
 from test.support import EnvironmentVarGuard
 
@@ -25,6 +26,8 @@
         super().tearDown()
 
     def _log(self, level, msg, args):
+        if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
+            raise ValueError('%s wrong log level' % str(level))
         self.logs.append((level, msg, args))
 
     def get_logs(self, *levels):

Modified: python/branches/release31-maint/Lib/distutils/tests/test_dist.py
==============================================================================
--- python/branches/release31-maint/Lib/distutils/tests/test_dist.py	(original)
+++ python/branches/release31-maint/Lib/distutils/tests/test_dist.py	Mon Sep 21 15:59:07 2009
@@ -149,6 +149,13 @@
         self.assertEquals(cmds, ['distutils.command', 'one', 'two'])
 
 
+    def test_announce(self):
+        # make sure the level is known
+        dist = Distribution()
+        args = ('ok',)
+        kwargs = {'level': 'ok2'}
+        self.assertRaises(ValueError, dist.announce, args, kwargs)
+
 class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
                        unittest.TestCase):
 

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Mon Sep 21 15:59:07 2009
@@ -21,6 +21,8 @@
 Library
 -------
 
+- Issue #6954: Fixed crash when using DISTUTILS_DEBUG flag in Distutils.
+
 - Issue #4606: Passing 'None' if ctypes argtype is set to POINTER(...)
   does now always result in NULL.
 


More information about the Python-checkins mailing list