summaryrefslogtreecommitdiff
path: root/sphinx/util/pycompat.py
diff options
context:
space:
mode:
authorPeter Bell <peterbell10@live.co.uk>2020-07-15 00:08:44 +0100
committerPeter Bell <peterbell10@live.co.uk>2020-07-15 00:12:31 +0100
commitbedc00faa6c1c35ab11673734c462d9652651da5 (patch)
tree4a18da8ec248ad49b94d05491f00f3320fc0a07a /sphinx/util/pycompat.py
parentd5482643d70e9ead27b3e4ecbfffacabf27e3e5f (diff)
downloadsphinx-git-bedc00faa6c1c35ab11673734c462d9652651da5.tar.gz
Require canonical name to be specified when calling deprecated_alias
Diffstat (limited to 'sphinx/util/pycompat.py')
-rw-r--r--sphinx/util/pycompat.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py
index 2173fce14..6ec180f0b 100644
--- a/sphinx/util/pycompat.py
+++ b/sphinx/util/pycompat.py
@@ -15,7 +15,8 @@ import textwrap
import warnings
from typing import Any, Callable
-from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
+from sphinx.deprecation import (
+ RemovedInSphinx40Warning, deprecated_alias, deprecated_attribute)
from sphinx.locale import __
from sphinx.util import logging
from sphinx.util.console import terminal_safe
@@ -91,12 +92,13 @@ def execfile_(filepath: str, _globals: Any, open: Callable = open) -> None:
deprecated_alias('sphinx.util.pycompat',
{
- 'NoneType': NoneType,
- 'TextIOWrapper': io.TextIOWrapper,
- 'htmlescape': html.escape,
- 'indent': textwrap.indent,
- 'terminal_safe': terminal_safe,
- 'sys_encoding': sys.getdefaultencoding(),
- 'u': '',
+ 'NoneType': ('sphinx.util.typing.NoneType', NoneType),
+ 'TextIOWrapper': ('io.TextIOWrapper', io.TextIOWrapper),
+ 'htmlescape': ('html.escape', html.escape),
+ 'indent': ('textwrap.indent', textwrap.indent),
+ 'terminal_safe': ('sphinx.util.console.terminal_safe', terminal_safe),
+ 'sys_encoding': ('sys.getdefaultencoding', sys.getdefaultencoding()),
},
RemovedInSphinx40Warning)
+
+deprecated_attribute('sphinx.util.pycompat', {'u': ''}, RemovedInSphinx40Warning)