[Python-checkins] r73498 - in python/branches/py3k: Lib/logging/__init__.py Misc/NEWS

vinay.sajip python-checkins at python.org
Sun Jun 21 19:46:50 CEST 2009


Author: vinay.sajip
Date: Sun Jun 21 19:46:49 2009
New Revision: 73498

Log:
Issue #6314: logging.basicConfig() performs extra checks on the "level" argument.

Modified:
   python/branches/py3k/Lib/logging/__init__.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/logging/__init__.py
==============================================================================
--- python/branches/py3k/Lib/logging/__init__.py	(original)
+++ python/branches/py3k/Lib/logging/__init__.py	Sun Jun 21 19:46:49 2009
@@ -1396,6 +1396,10 @@
         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)
 
 #---------------------------------------------------------------------------

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sun Jun 21 19:46:49 2009
@@ -15,12 +15,15 @@
 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)
 
 


More information about the Python-checkins mailing list