]> granicus.if.org Git - python/commitdiff
Fixes #27937: optimise code used in all logging calls.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 3 Sep 2016 14:56:07 +0000 (15:56 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sat, 3 Sep 2016 14:56:07 +0000 (15:56 +0100)
Lib/logging/__init__.py

index 4d872bd044dfd09e4da00fafae1c412a7796e4ae..0c5c2ec28f9efb6e6cd3e4776faa0f2eb716fcc0 100644 (file)
@@ -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):
     """