mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Closes #22386: merged fix from 3.4.
This commit is contained in:
commit
a56411e5d4
3 changed files with 8 additions and 3 deletions
|
|
@ -1052,8 +1052,8 @@ functions.
|
||||||
.. versionchanged:: 3.4
|
.. versionchanged:: 3.4
|
||||||
In Python versions earlier than 3.4, this function could also be passed a
|
In Python versions earlier than 3.4, this function could also be passed a
|
||||||
text level, and would return the corresponding numeric value of the level.
|
text level, and would return the corresponding numeric value of the level.
|
||||||
This undocumented behaviour was a mistake, and has been removed in Python
|
This undocumented behaviour was considered a mistake, and was removed in
|
||||||
3.4.
|
Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility.
|
||||||
|
|
||||||
.. function:: makeLogRecord(attrdict)
|
.. function:: makeLogRecord(attrdict)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,8 @@ def getLevelName(level):
|
||||||
|
|
||||||
Otherwise, the string "Level %s" % level is returned.
|
Otherwise, the string "Level %s" % level is returned.
|
||||||
"""
|
"""
|
||||||
return _levelToName.get(level, ("Level %s" % level))
|
# See Issue #22386 for the reason for this convoluted expression
|
||||||
|
return _levelToName.get(level, _nameToLevel.get(level, ("Level %s" % level)))
|
||||||
|
|
||||||
def addLevelName(level, levelName):
|
def addLevelName(level, levelName):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,10 @@ class BuiltinLevelsTest(BaseTest):
|
||||||
('INF.BADPARENT', 'INFO', '4'),
|
('INF.BADPARENT', 'INFO', '4'),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def test_regression_22386(self):
|
||||||
|
"""See issue #22386 for more information."""
|
||||||
|
self.assertEqual(logging.getLevelName('INFO'), logging.INFO)
|
||||||
|
self.assertEqual(logging.getLevelName(logging.INFO), 'INFO')
|
||||||
|
|
||||||
class BasicFilterTest(BaseTest):
|
class BasicFilterTest(BaseTest):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue