diff --git a/sphinx/deprecation.py b/sphinx/deprecation.py index fbd5463cce3..d708fdaa0c3 100644 --- a/sphinx/deprecation.py +++ b/sphinx/deprecation.py @@ -5,15 +5,15 @@ import warnings -class RemovedInSphinx70Warning(DeprecationWarning): +class RemovedInSphinx80Warning(DeprecationWarning): pass -class RemovedInSphinx80Warning(PendingDeprecationWarning): +class RemovedInSphinx90Warning(PendingDeprecationWarning): pass -RemovedInNextVersionWarning = RemovedInSphinx70Warning +RemovedInNextVersionWarning = RemovedInSphinx80Warning def _deprecation_warning( @@ -31,7 +31,7 @@ def _deprecation_warning( # deprecated name -> (object to return, canonical path or empty string) _DEPRECATED_OBJECTS = { - 'deprecated_name': (object_to_return, 'fully_qualified_replacement_name'), + 'deprecated_name': (object_to_return, 'fully_qualified_replacement_name', (8, 0)), } @@ -41,15 +41,15 @@ def __getattr__(name): from sphinx.deprecation import _deprecation_warning - deprecated_object, canonical_name = _DEPRECATED_OBJECTS[name] - _deprecation_warning(__name__, name, canonical_name, remove=(7, 0)) + deprecated_object, canonical_name, remove = _DEPRECATED_OBJECTS[name] + _deprecation_warning(__name__, name, canonical_name, remove=remove) return deprecated_object """ - if remove == (7, 0): - warning_class: type[Warning] = RemovedInSphinx70Warning - elif remove == (8, 0): - warning_class = RemovedInSphinx80Warning + if remove == (8, 0): + warning_class: type[Warning] = RemovedInSphinx80Warning + elif remove == (9, 0): + warning_class = RemovedInSphinx90Warning else: raise RuntimeError(f'removal version {remove!r} is invalid!')