]> granicus.if.org Git - python/commitdiff
Issue #6314: logging.basicConfig() performs extra checks on the "level" argument.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sun, 21 Jun 2009 17:37:27 +0000 (17:37 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sun, 21 Jun 2009 17:37:27 +0000 (17:37 +0000)
Lib/logging/__init__.py
Misc/NEWS

index 456dec906a3e9b07068161350d8786874f7117f7..23f7930b69708505cef28363c51e42d2a25c807e 100644 (file)
@@ -1397,6 +1397,10 @@ def basicConfig(**kwargs):
         root.addHandler(hdlr)
         level = kwargs.get("level")
         if level is not None:
+            if str(level) == level: # If a string was passed, do more checks
+                if level not in _levelNames:
+                    raise ValueError("Unknown level: %r" % level)
+                level = _levelNames[level]
             root.setLevel(level)
 
 #---------------------------------------------------------------------------
index 86666ffaa2caa781a924fbaf200a7b88e8ed7021..2985c3aa70e18014c38bcc9035e52bc541cdd70c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -327,7 +327,10 @@ Core and Builtins
 Library
 -------
 
-- Issue #6164: Added an AIX specific linker argument in Distutils 
+- Issue #6314: logging.basicConfig() performs extra checks on the "level"
+  argument.
+
+- Issue #6164: Added an AIX specific linker argument in Distutils
   unixcompiler. Original patch by Sridhar Ratnakumar.
 
 - Issue #6274: Fixed possible file descriptors leak in subprocess.py