diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-06-21 17:37:27 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-06-21 17:37:27 +0000 |
commit | 603fb6d66759afe8b5f65f2d456a43e73bb89233 (patch) | |
tree | 175a35f50e0e16c81461e2046778babab3af40d1 /Lib/logging | |
parent | 7f146ab0ca5443a54f575b24965106a0e967a9dc (diff) | |
download | cpython-git-603fb6d66759afe8b5f65f2d456a43e73bb89233.tar.gz |
Issue #6314: logging.basicConfig() performs extra checks on the "level" argument.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
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) #--------------------------------------------------------------------------- |