[Python-checkins] cpython: Fixes #27937: optimise code used in all logging calls.

vinay.sajip python-checkins at python.org
Sat Sep 3 11:55:44 EDT 2016


https://hg.python.org/cpython/rev/0986401d0733
changeset: 103017:0986401d0733
parent: 103015:899ee1e68a8d
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Sat Sep 03 15:56:07 2016 +0100
summary:
 Fixes #27937: optimise code used in all logging calls.
files:
 Lib/logging/__init__.py | 5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -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):
 """
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /