Un-deprecate `sphinx.util.import_object` (#13330)

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
Matthias Geier 2025-02-11 20:07:27 +01:00 committed by GitHub
parent 9069005087
commit 94563a398b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 13 deletions

View File

@ -27,6 +27,8 @@ Deprecated
* #13037: Deprecate the ``SingleHTMLBuilder.fix_refuris`` method.
Patch by James Addison.
* #13083, #13330: Un-deprecate ``sphinx.util.import_object``.
Patch by Matthias Geier.
Features added
--------------

View File

@ -37,11 +37,6 @@ The following is a list of deprecated interfaces.
- 10.0
- N/A
* - ``sphinx.util.import_object``
- 8.1
- 10.0
- ``importlib.import_module``
* - ``sphinx.ext.intersphinx.normalize_intersphinx_mapping``
- 8.0
- 10.0

View File

@ -98,12 +98,6 @@ def __getattr__(name: str) -> Any:
_deprecation_warning(__name__, name, '', remove=(10, 0))
return obj
if name == 'import_object':
from sphinx.util._importer import import_object
_deprecation_warning(__name__, name, '', remove=(10, 0))
return import_object
# Re-exported for backwards compatibility,
# but not currently deprecated
@ -112,6 +106,11 @@ def __getattr__(name: str) -> Any:
return encode_uri
if name == 'import_object':
from sphinx.util._importer import import_object
return import_object
if name == 'isurl':
from sphinx.util._uri import is_url

View File

@ -69,12 +69,11 @@ def test_exported_attributes():
assert sphinx.util.FilenameUniqDict is FilenameUniqDict
with pytest.warns(RemovedInSphinx10Warning, match=r'deprecated.'):
assert sphinx.util.DownloadFiles is DownloadFiles
with pytest.warns(RemovedInSphinx10Warning, match=r'deprecated.'):
assert sphinx.util.import_object is import_object
# Re-exported for backwards compatibility,
# but not currently deprecated
assert sphinx.util.encode_uri is encode_uri
assert sphinx.util.import_object is import_object
assert sphinx.util.isurl is is_url
assert sphinx.util.parselinenos is parse_line_num_spec
assert sphinx.util.patfilter is patfilter