summaryrefslogtreecommitdiff
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2017-01-11 06:57:55 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2017-01-11 06:57:55 +0000
commitd58327d81a616ff39c01cd3bdee95c1309826d52 (patch)
tree7e7939d693d2739e46c29f79a5de1fa356916535 /Lib/logging/__init__.py
parent36e18bf2fa1a07b5f7b67f55c038cdb90a17dc19 (diff)
downloadcpython-d58327d81a616ff39c01cd3bdee95c1309826d52.tar.gz
Closes #29220: Fixed regression in logging.getLevelName().
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r--Lib/logging/__init__.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index d886d35c12..fb866f39d9 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):
"""