diff options
Diffstat (limited to 'sphinx/util/pycompat.py')
-rw-r--r-- | sphinx/util/pycompat.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py index 3d31abb1e..da2bcc255 100644 --- a/sphinx/util/pycompat.py +++ b/sphinx/util/pycompat.py @@ -22,6 +22,8 @@ if False: # For type annotation from typing import Any, Callable # NOQA +from sphinx.deprecation import RemovedInSphinx16Warning + NoneType = type(None) # ------------------------------------------------------------------------------ @@ -113,7 +115,8 @@ def execfile_(filepath, _globals, open=open): from sphinx.util.osutil import fs_encoding # get config source -- 'b' is a no-op under 2.x, while 'U' is # ignored under 3.x (but 3.x compile() accepts \r\n newlines) - with open(filepath, 'rbU') as f: + mode = 'rb' if PY3 else 'rbU' + with open(filepath, mode) as f: source = f.read() # py26 accept only LF eol instead of CRLF @@ -147,9 +150,9 @@ class _DeprecationWrapper(object): def __getattr__(self, attr): if attr in self._deprecated: warnings.warn("sphinx.util.pycompat.%s is deprecated and will be " - "removed in Sphinx 1.4, please use the standard " + "removed in Sphinx 1.6, please use the standard " "library version instead." % attr, - DeprecationWarning, stacklevel=2) + RemovedInSphinx16Warning, stacklevel=2) return self._deprecated[attr] return getattr(self._mod, attr) |