Fix #7423: crashed when giving a non-string object to logger

This commit is contained in:
Takeshi KOMIYA committed 2020-04-09 00:17:37 +09:00
1 parent 2def1fc704
commit 1ca220762b
3 files changed
+11 -1

No files matched your search

+2
View File
@@ -16,6 +16,8 @@ Features added
Bugs fixed
----------
* #7423: crashed when giving a non-string object to logger
Testing
--------
+1 -1
View File
@@ -412,7 +412,7 @@ class WarningIsErrorFilter(logging.Filter):
message = record.msg # use record.msg itself
if location:
raise SphinxWarning(location + ":" + message)
raise SphinxWarning(location + ":" + str(message))
else:
raise SphinxWarning(message)
else:
+8
View File
@@ -48,6 +48,14 @@ def test_info_and_warning(app, status, warning):
assert 'message5' in warning.getvalue()
def test_Exception(app, status, warning):
logging.setup(app, status, warning)
logger = logging.getLogger(__name__)
logger.info(Exception)
assert "<class 'Exception'>" in status.getvalue()
def test_verbosity_filter(app, status, warning):
# verbosity = 0: INFO
app.verbosity = 0