From 39a45ad4073a4d8c3b7dfd64d22e8a88870dcc7c Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 12 Oct 2024 19:29:51 +0100 Subject: [PATCH] Expose ``ExtensionError`` in ``sphinx.util`` for backwards compatibility. This will be removed in Sphinx 9, as exposing the exception in ``sphinx.util`` was never intentional. ``ExtensionError`` has been part of ``sphinx.errors`` since v0.9. --- CHANGES.rst | 6 ++++++ sphinx/util/__init__.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 1c5a45a7f26..0ab26a89cc2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,12 @@ Release 8.1.2 (in development) Bugs fixed ---------- +* #13012: Expose :exc:`sphinx.errors.ExtensionError` in ``sphinx.util`` + for backwards compatibility. + This will be removed in Sphinx 9, as exposing the exception + in ``sphinx.util`` was never intentional. + :exc:`!ExtensionError` has been part of ``sphinx.errors`` since Sphinx 0.9. + Patch by Adam Turner. Release 8.1.1 (released Oct 11, 2024) ===================================== diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 07af8602079..73a66a9a60d 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -8,6 +8,7 @@ import re from typing import Any +from sphinx.errors import ExtensionError as _ExtensionError from sphinx.errors import FiletypeNotFoundError from sphinx.util import _files, _importer, logging from sphinx.util import index_entries as _index_entries @@ -86,6 +87,7 @@ def _sha1(data: bytes = b'', **_kw: Any) -> hashlib._Hash: 'sphinx.util.index_entries.split_into', (9, 0), ), + 'ExtensionError': (_ExtensionError, 'sphinx.errors.ExtensionError', (9, 0)), 'md5': (_md5, '', (9, 0)), 'sha1': (_sha1, '', (9, 0)), 'import_object': (_importer.import_object, '', (10, 0)),