Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f6eac2

Browse files
committed
Issue #6314: logging.basicConfig() performs extra checks on the "level" argument.
1 parent 2a998fa commit 0f6eac2

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lib/logging/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,10 @@ def basicConfig(**kwargs):
13961396
root.addHandler(hdlr)
13971397
level = kwargs.get("level")
13981398
if level is not None:
1399+
if str(level) == level: # If a string was passed, do more checks
1400+
if level not in _levelNames:
1401+
raise ValueError("Unknown level: %r" % level)
1402+
level = _levelNames[level]
13991403
root.setLevel(level)
14001404

14011405
#---------------------------------------------------------------------------

Misc/NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ Core and Builtins
1515
Library
1616
-------
1717

18+
- Issue #6314: logging.basicConfig() performs extra checks on the "level"
19+
argument.
20+
1821
- Issue #6274: Fixed possible file descriptors leak in subprocess.py
1922

2023
- Accessing io.StringIO.buffer now raises an AttributeError instead of
2124
io.UnsupportedOperation.
2225

23-
- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
26+
- Issue #6271: mmap tried to close invalid file handle (-1) when anonymous.
2427
(On Unix)
2528

2629

0 commit comments

Comments
 (0)