diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-11 17:35:36 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-11 17:35:36 (GMT) |
commit | 924aaae4c2a99015ca6b448f16eed31bbb598b98 (patch) | |
tree | fd60c3aefa82b95cec40429bbd975348b82b6669 /Lib/logging/__init__.py | |
parent | 9da31f7274472903a32407a4e8227d1f295672a6 (diff) | |
download | cpython-924aaae4c2a99015ca6b448f16eed31bbb598b98.zip cpython-924aaae4c2a99015ca6b448f16eed31bbb598b98.tar.gz cpython-924aaae4c2a99015ca6b448f16eed31bbb598b98.tar.bz2 |
Issue #29220: Improved fix and test.
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r-- | Lib/logging/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 22744e1..6455f39 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -129,9 +129,14 @@ def getLevelName(level): Otherwise, the string "Level %s" % level is returned. """ - # See Issues #22386 and #27937 for why it's this way - return (_levelToName.get(level) or _nameToLevel.get(level) or - "Level %s" % level) + # See Issues #22386, #27937 and #29220 for why it's this way + result = _levelToName.get(level) + if result is not None: + return result + result = _nameToLevel.get(level) + if result is not None: + return result + return "Level %s" % level def addLevelName(level, levelName): """ |