]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #6314: logging.basicConfig() performs extra checks on the "level" argument.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sun, 21 Jun 2009 17:46:49 +0000 (17:46 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sun, 21 Jun 2009 17:46:49 +0000 (17:46 +0000)
Lib/logging/__init__.py
Misc/NEWS

index 9780c830aefccd665b866d1135995d3451aece61..f932110df49cc6ee790399a76ba635a206671070 100644 (file)
@@ -1396,6 +1396,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 7ecb6d70c13b30ade8d8ec3429f3e6ab7f9188cf..d433d4ca6b7c221b77a113d6fe7dccd2f1f51329 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,12 +15,15 @@ Core and Builtins
 Library
 -------
 
+- Issue #6314: logging.basicConfig() performs extra checks on the "level"
+  argument.
+
 - Issue #6274: Fixed possible file descriptors leak in subprocess.py
 
 - Accessing io.StringIO.buffer now raises an AttributeError instead of
   io.UnsupportedOperation.
 
-- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
+- Issue #6271: mmap tried to close invalid file handle (-1) when anonymous.
   (On Unix)