From: Vinay Sajip Date: Sun, 21 Jun 2009 17:46:49 +0000 (+0000) Subject: Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. X-Git-Tag: v3.1~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f6eac2ad209157444e30f01dfd53f084332e3d8;p=thirdparty%2FPython%2Fcpython.git Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 9780c830aefc..f932110df49c 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -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) #--------------------------------------------------------------------------- diff --git a/Misc/NEWS b/Misc/NEWS index 7ecb6d70c13b..d433d4ca6b7c 100644 --- 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)