From: Vinay Sajip Date: Sat, 3 Sep 2016 14:56:07 +0000 (+0100) Subject: Fixes #27937: optimise code used in all logging calls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a7b7e30ff15426c99087a4e191234e02b2ed4d6;p=python Fixes #27937: optimise code used in all logging calls. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 4d872bd044..0c5c2ec28f 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): """