diff --git a/CHANGES b/CHANGES index b12cfd398c6..59b48979394 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,7 @@ Bugs fixed * #7418: std domain: duplication warning for glossary terms is case insensitive * #7438: C++, fix merging overloaded functions in parallel builds. * #7422: autodoc: fails with ValueError when using autodoc_mock_imports +* #7423: crashed when giving a non-string object to logger Testing -------- diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py index fbf161ec038..53053faaf5d 100644 --- a/sphinx/util/logging.py +++ b/sphinx/util/logging.py @@ -412,7 +412,7 @@ def filter(self, record: logging.LogRecord) -> bool: message = record.msg # use record.msg itself if location: - raise SphinxWarning(location + ":" + message) + raise SphinxWarning(location + ":" + str(message)) else: raise SphinxWarning(message) else: diff --git a/tests/test_util_logging.py b/tests/test_util_logging.py index 337782d8718..36034cd92b4 100644 --- a/tests/test_util_logging.py +++ b/tests/test_util_logging.py @@ -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 "" in status.getvalue() + + def test_verbosity_filter(app, status, warning): # verbosity = 0: INFO app.verbosity = 0