summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-09-21 13:59:07 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-09-21 13:59:07 (GMT)
commit0cdc36972bc157cda88c3d412809290e43496216 (patch)
treefadb59e8f7a2d88a8687b1e1f8c4879e240f88c5
parent83496698249fbcfd0efb875d882a6e883db4bf6d (diff)
downloadcpython-0cdc36972bc157cda88c3d412809290e43496216.zip
cpython-0cdc36972bc157cda88c3d412809290e43496216.tar.gz
cpython-0cdc36972bc157cda88c3d412809290e43496216.tar.bz2
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) ........ ................
-rw-r--r--Lib/distutils/dist.py2
-rw-r--r--Lib/distutils/log.py3
-rw-r--r--Lib/distutils/tests/support.py3
-rw-r--r--Lib/distutils/tests/test_dist.py7
-rw-r--r--Misc/NEWS2
5 files changed, 16 insertions, 1 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index ac5a0ca..1c1ea47 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -354,7 +354,7 @@ Common commands: (see '--help-commands' for more)
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)
diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py
index 6f949d5..7588570 100644
--- a/Lib/distutils/log.py
+++ b/Lib/distutils/log.py
@@ -17,6 +17,9 @@ class Log:
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
diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py
index 1255413..ea12211 100644
--- a/Lib/distutils/tests/support.py
+++ b/Lib/distutils/tests/support.py
@@ -4,6 +4,7 @@ import shutil
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 @@ class LoggingSilencer(object):
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):
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index 9f795f4..70c9ec5 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -149,6 +149,13 @@ class DistributionTestCase(support.LoggingSilencer,
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):
diff --git a/Misc/NEWS b/Misc/NEWS
index 5236a9e..41edb17 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,8 @@ Core and Builtins
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.