gh-90953: Emit deprecation warnings for deprecated ast features by serhiy-storchaka · Pull Request #31432 · python/cpython (original) (raw)
(Merge conflict resolved)
There's about a week until the 3.12 cutoff. I think it's okay to include ExtSlice
here, it's replacement Tuple
has been around for a long time, and ast.*ExtSlice
shows up in 22 projects in the PyPI top 5k:
❯ python3 ~/github/misc/cpython/search_pypi_top.py -q . "ast.*ExtSlice"
./pyre-check-nightly-0.0.101680433836.tar.gz: pyre-check-nightly-0.0.101680433836/typeshed/stubs/pyflakes/pyflakes/checker.pyi: def EXTSLICE(self, tree: ast.ExtSlice, omit: OmitType = ...) -> None: ...
./reportlab-3.6.12.tar.gz: reportlab-3.6.12/src/reportlab/lib/rl_safe_eval.py: elif isinstance(slice, ast.ExtSlice):
./typed_ast-1.5.4.tar.gz: typed_ast-1.5.4/ast27/Python/Python-ast.c: value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice);
./typed_ast-1.5.4.tar.gz: typed_ast-1.5.4/ast3/Python/Python-ast.c: value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice);
./mypy-1.1.1.tar.gz: mypy-1.1.1/mypy/fastparse.py: is_py38_or_earlier and isinstance(n.slice, ast3.ExtSlice)
./mypy-1.1.1.tar.gz: mypy-1.1.1/mypy/fastparse.py: def visit_ExtSlice(self, n: ast3.ExtSlice) -> TupleExpr:
./mypy-1.1.1.tar.gz: mypy-1.1.1/mypy/fastparse.py: assert isinstance(n.slice, ast3.ExtSlice)
./pure_eval-0.2.2.tar.gz: pure_eval-0.2.2/pure_eval/core.py: elif isinstance(index, ast.ExtSlice):
./gast-0.5.3.tar.gz: gast-0.5.3/gast/ast3.py: new_slice = ast.ExtSlice(
./gast-0.5.3.tar.gz: gast-0.5.3/gast/ast2.py: new_slice = ast.ExtSlice([adjust_slice(self._visit(elt))
./ipython-8.12.0.tar.gz: ipython-8.12.0/IPython/core/guarded_eval.py: if isinstance(node, ast.ExtSlice):
./flake8_expression_complexity-0.0.11.tar.gz: flake8_expression_complexity-0.0.11/flake8_expression_complexity/utils/complexity.py: (ast.ExtSlice, 'ext_slice'),
./astroid-2.15.1.tar.gz: astroid-2.15.1/astroid/nodes/node_classes.py: """Class representing an :class:ast.ExtSlice
node.
./astroid-2.15.1.tar.gz: astroid-2.15.1/astroid/rebuilder.py: def visit(self, node: ast.ExtSlice, parent: nodes.Subscript) -> nodes.Tuple:
./astroid-2.15.1.tar.gz: astroid-2.15.1/astroid/rebuilder.py: self, node: ast.ExtSlice, parent: nodes.Subscript
./asttokens-2.2.1.tar.gz: asttokens-2.2.1/asttokens/asttokens.py: ast.Slice, ast.ExtSlice, ast.Index, ast.keyword,
./asttokens-2.2.1.tar.gz: asttokens-2.2.1/asttokens/asttokens.py: - ast.ExtSlice
./griffe-0.25.5.tar.gz: griffe-0.25.5/src/griffe/agents/nodes.py: from ast import ExtSlice as NodeExtSlice
./numba-0.56.4.tar.gz: numba-0.56.4/numba/tests/test_stencils.py: slice=ast.ExtSlice(
./numba-0.56.4.tar.gz: numba-0.56.4/numba/tests/test_stencils.py: if isinstance(node.slice, ast.ExtSlice):
./pytype-2023.3.31.tar.gz: pytype-2023.3.31/pytype/typeshed/stubs/pyflakes/pyflakes/checker.pyi: def EXTSLICE(self, tree: ast.ExtSlice, omit: OmitType = ...) -> None: ...
./RestrictedPython-6.0.tar.gz: RestrictedPython-6.0/src/RestrictedPython/transformer.py: elif isinstance(slice, ast.ExtSlice):
Time: 0:00:17.604108 Found 22 matching lines in 14 projects
But I'm also okay to splitting it into another PR and merging it after the 3.13 branch in about a week and a few days.
In any case, let's add this to What's New.