summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2016-09-03 14:56:07 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2016-09-03 14:56:07 (GMT)
commit0a7b7e30ff15426c99087a4e191234e02b2ed4d6 (patch)
treecf99880a2a78c2bf76e9f2f2a964c364928a1b36 /Lib
parent6e025608a291604c4a125da1e6278c61733d7c3e (diff)
downloadcpython-0a7b7e30ff15426c99087a4e191234e02b2ed4d6.zip
cpython-0a7b7e30ff15426c99087a4e191234e02b2ed4d6.tar.gz
cpython-0a7b7e30ff15426c99087a4e191234e02b2ed4d6.tar.bz2
Fixes #27937: optimise code used in all logging calls.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 4d872bd..0c5c2ec 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -130,8 +130,9 @@ def getLevelName(level):
Otherwise, the string "Level %s" % level is returned.
"""
- # See Issue #22386 for the reason for this convoluted expression
- return _levelToName.get(level, _nameToLevel.get(level, ("Level %s" % level)))
+ # See Issues #22386 and #27937 for why it's this way
+ return (_levelToName.get(level) or _nameToLevel.get(level) or
+ "Level %s" % level)
def addLevelName(level, levelName):
"""