(original) (raw)
changeset: 103017:0986401d0733 parent: 103015:899ee1e68a8d user: Vinay Sajip <vinay_sajip@yahoo.co.uk> date: Sat Sep 03 15:56:07 2016 +0100 files: Lib/logging/__init__.py description: Fixes #27937: optimise code used in all logging calls. diff -r 899ee1e68a8d -r 0986401d0733 Lib/logging/__init__.py --- a/Lib/logging/__init__.py Sat Sep 03 10:43:20 2016 -0400 +++ b/Lib/logging/__init__.py Sat Sep 03 15:56:07 2016 +0100 @@ -130,8 +130,9 @@ 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): """ </vinay_sajip@yahoo.co.uk>