From a614772a2836dbdba39a27aae17c2b07e74d9b20 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 24 Apr 2023 08:17:50 +0100 Subject: [PATCH 1/2] Remove pycode.ast.parse --- sphinx/pycode/ast.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py index 58c0fc056df..6596287afc3 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 @@ } -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: ... From 004a3c72896d462d9a29f882926bfa2c189dc0a8 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Thu, 27 Apr 2023 14:53:29 +0100 Subject: [PATCH 2/2] CHANGES --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 9d3edcb8969..099f422cd36 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ Incompatible changes * #11365: Remove support for the ``jsdump`` format in ``sphinx.search``. * #11366: Make ``locale`` a required argument to ``sphinx.util.i18n.format_date()``. +* #11371: Remove deprecated ``sphinx.pycode.ast.parse()`` function. Deprecated ----------