diff options
| author | Peter Bell <peterbell10@live.co.uk> | 2020-07-13 20:29:52 +0100 |
|---|---|---|
| committer | Peter Bell <peterbell10@live.co.uk> | 2020-07-13 20:35:55 +0100 |
| commit | d5482643d70e9ead27b3e4ecbfffacabf27e3e5f (patch) | |
| tree | d81e37a7fdf5aae88ec5a0bfb4c677d93d13febb | |
| parent | e1a19d8b83641c14fd8c884142d61100f99b6769 (diff) | |
| download | sphinx-git-d5482643d70e9ead27b3e4ecbfffacabf27e3e5f.tar.gz | |
Improve warning message from deprecated_alias
| -rw-r--r-- | sphinx/deprecation.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sphinx/deprecation.py b/sphinx/deprecation.py index 6f0fb2db4..dc0fec8a1 100644 --- a/sphinx/deprecation.py +++ b/sphinx/deprecation.py @@ -44,10 +44,13 @@ class _ModuleWrapper: def __getattr__(self, name: str) -> Any: if name in self._objects: - warnings.warn("%s.%s is deprecated. Check CHANGES for Sphinx " - "API modifications." % (self._modname, name), - self._warning, stacklevel=3) - return self._objects[name] + obj = self._objects[name] + warnings.warn( + "The alias '{}.{}' is deprecated, use '{}.{}' instead. Check CHANGES for " + "Sphinx API modifications.".format( + self._modname, name, obj.__module__, obj.__name__), + self._warning, stacklevel=3) + return obj return getattr(self._module, name) |
