summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2023-04-27 15:18:44 +0100
committerGitHub <noreply@github.com>2023-04-27 15:18:44 +0100
commit24f476949d698d4a90f385eac3a2e8868b6a34f8 (patch)
tree008a0c3c4762a49328beaefe63b7b4a0115afad6
parent583fb74bd463aa7f03d6759e9ddcbd1927071348 (diff)
downloadsphinx-git-24f476949d698d4a90f385eac3a2e8868b6a34f8.tar.gz
Remove deprecated ``sphinx.pycode.ast.parse()`` (#11371)
-rw-r--r--CHANGES1
-rw-r--r--sphinx/pycode/ast.py17
2 files changed, 1 insertions, 17 deletions
diff --git a/CHANGES b/CHANGES
index 72ee3bf64..7bd8f7250 100644
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,7 @@ Incompatible changes
* #11366: Make ``locale`` a required argument to
``sphinx.util.i18n.format_date()``.
* #11370: Remove deprecated ``sphinx.util.stemmer`` module.
+* #11371: Remove deprecated ``sphinx.pycode.ast.parse()`` function.
Deprecated
----------
diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py
index 58c0fc056..6596287af 100644
--- a/sphinx/pycode/ast.py
+++ b/sphinx/pycode/ast.py
@@ -3,11 +3,8 @@
from __future__ import annotations
import ast
-import warnings
from typing import overload
-from sphinx.deprecation import RemovedInSphinx70Warning
-
OPERATORS: dict[type[ast.AST], str] = {
ast.Add: "+",
ast.And: "and",
@@ -31,20 +28,6 @@ OPERATORS: dict[type[ast.AST], str] = {
}
-def parse(code: str, mode: str = 'exec') -> ast.AST:
- """Parse the *code* using the built-in ast module."""
- warnings.warn(
- "'sphinx.pycode.ast.parse' is deprecated, use 'ast.parse' instead.",
- RemovedInSphinx70Warning, stacklevel=2,
- )
- try:
- return ast.parse(code, mode=mode, type_comments=True)
- except SyntaxError:
- # Some syntax error found. To ignore invalid type comments, retry parsing without
- # type_comments parameter (refs: https://github.com/sphinx-doc/sphinx/issues/8652).
- return ast.parse(code, mode=mode)
-
-
@overload
def unparse(node: None, code: str = '') -> None:
...