Author: Robert Zaremba <robert.zare...@scale-it.pl> Branch: py3.5 Changeset: r90430:55230b1507ef Date: 2017-02-28 18:33 +0100 http://bitbucket.org/pypy/pypy/changeset/55230b1507ef/
Log: Fix logging.getLevelName, applying #29220 CPython issue. The getLevelName function incorrectly fallsback. 0 is correct value returned from the names map, but when using `or` check it falsifies and fallback to the "level" case. http://buildbot.pypy.org/summary/longrepr?testname=unmodified&builde r=pypy-c-jit-linux-x86-64&build=4416&mod=lib- python.3.test.test_logging diff --git a/lib-python/3/logging/__init__.py b/lib-python/3/logging/__init__.py --- a/lib-python/3/logging/__init__.py +++ b/lib-python/3/logging/__init__.py @@ -129,9 +129,14 @@ Otherwise, the string "Level %s" % level is returned. """ - # See Issues #22386 and #27937 for why it's this way - return (_levelToName.get(level) or _nameToLevel.get(level) or - "Level %s" % level) + # See Issues #22386, #27937 and #29220 for why it's this way + result = _levelToName.get(level) + if result is not None: + return result + result = _nameToLevel.get(level) + if result is not None: + return result + return "Level %s" % level def addLevelName(level, levelName): """ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit