From f53825d08b21e49afa26e60e21bdebce8e79525d Mon Sep 17 00:00:00 2001 From: "vinay.sajip" Date: Sun, 21 Jun 2009 17:37:27 +0000 Subject: [PATCH] Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. git-svn-id: http://svn.python.org/projects/python/trunk@73496 6015fed2-1504-0410-9fe1-9d1591cc4771 --- Lib/logging/__init__.py | 4 ++++ Misc/NEWS | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 456dec906a..23f7930b69 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -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) #--------------------------------------------------------------------------- diff --git a/Misc/NEWS b/Misc/NEWS index 86666ffaa2..2985c3aa70 100644 --- 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 -- 2.11.4.GIT