diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2016-09-03 14:56:07 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2016-09-03 14:56:07 (GMT) |
commit | 0a7b7e30ff15426c99087a4e191234e02b2ed4d6 (patch) | |
tree | cf99880a2a78c2bf76e9f2f2a964c364928a1b36 /Lib | |
parent | 6e025608a291604c4a125da1e6278c61733d7c3e (diff) | |
download | cpython-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__.py | 5 |
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): """ |