From 2a8e4c8e9b3805ffbdf2dda002e48f2184cbffb2 Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Fri, 24 Apr 2026 14:24:28 -0500 Subject: [PATCH 1/2] intersphinx: Stringify error arguments in `_display_failures` Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- sphinx/ext/intersphinx/_load.py | 2 +- tests/test_ext_intersphinx/test_ext_intersphinx.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sphinx/ext/intersphinx/_load.py b/sphinx/ext/intersphinx/_load.py index ab6a373fea0..d849ff2d8f3 100644 --- a/sphinx/ext/intersphinx/_load.py +++ b/sphinx/ext/intersphinx/_load.py @@ -234,7 +234,7 @@ def _display_failures(failures: Sequence[tuple[str, ...]]) -> str: try: formatted.append(failure_args[0] % failure_args[1:]) except TypeError: - formatted.append(' - '.join(failure_args)) + formatted.append(' - '.join(map(str, failure_args))) return '\n'.join(formatted) diff --git a/tests/test_ext_intersphinx/test_ext_intersphinx.py b/tests/test_ext_intersphinx/test_ext_intersphinx.py index 5fcfe4d9260..27ef99db2a9 100644 --- a/tests/test_ext_intersphinx/test_ext_intersphinx.py +++ b/tests/test_ext_intersphinx/test_ext_intersphinx.py @@ -935,6 +935,7 @@ def test_display_failures(): 'http://example.com', 'http://proxyhost.net', ), # No '%' + (22, 'Invalid argument'), # Non-string argument ] issues = _display_failures(failures_args) assert 'Failed to fetch inventory from http://example.com' in issues @@ -943,3 +944,4 @@ def test_display_failures(): 'intersphinx inventory has moved: - http://example.com - http://proxyhost.net' in issues ) + assert "22 - Invalid argument" in issues From 2723afea6808cab21f02bea722525584272327c2 Mon Sep 17 00:00:00 2001 From: cobalt <61329810+cobaltt7@users.noreply.github.com> Date: Fri, 24 Apr 2026 14:57:23 -0500 Subject: [PATCH 2/2] Use single quotes Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com> --- tests/test_ext_intersphinx/test_ext_intersphinx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_ext_intersphinx/test_ext_intersphinx.py b/tests/test_ext_intersphinx/test_ext_intersphinx.py index 27ef99db2a9..e063e3ebbe5 100644 --- a/tests/test_ext_intersphinx/test_ext_intersphinx.py +++ b/tests/test_ext_intersphinx/test_ext_intersphinx.py @@ -944,4 +944,4 @@ def test_display_failures(): 'intersphinx inventory has moved: - http://example.com - http://proxyhost.net' in issues ) - assert "22 - Invalid argument" in issues + assert '22 - Invalid argument' in issues