diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-11 06:57:55 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-11 06:57:55 (GMT) |
commit | 8b866d5429c72227a6133d6964b9800a184556fd (patch) | |
tree | c5e124296909474694631375be71a02542512f55 /Lib/logging | |
parent | 231d1f3439f3a9c629eb3117ee72a653da0f6238 (diff) | |
download | cpython-8b866d5429c72227a6133d6964b9800a184556fd.zip cpython-8b866d5429c72227a6133d6964b9800a184556fd.tar.gz cpython-8b866d5429c72227a6133d6964b9800a184556fd.tar.bz2 |
Closes #29220: Fixed regression in logging.getLevelName().
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index d886d35..fb866f3 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -131,9 +131,13 @@ 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 None: + result = _nameToLevel.get(level) + if result is None: + result = "Level %s" % level + return result def addLevelName(level, levelName): """ |