Skip to content

Commit 8d02c2a

Browse files
authored
Use @deprecated for those visit methods of class NodeVisitor that deal with classes that have already been marked with @deprecated and add type: ignore[deprecated] comments. (#12864)
1 parent b0ac25e commit 8d02c2a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

stdlib/ast.pyi

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,11 +2023,19 @@ class NodeVisitor:
20232023
def visit_AugLoad(self, node: AugLoad) -> Any: ...
20242024
def visit_AugStore(self, node: AugStore) -> Any: ...
20252025
def visit_Param(self, node: Param) -> Any: ...
2026-
def visit_Num(self, node: Num) -> Any: ...
2027-
def visit_Str(self, node: Str) -> Any: ...
2028-
def visit_Bytes(self, node: Bytes) -> Any: ...
2029-
def visit_NameConstant(self, node: NameConstant) -> Any: ...
2030-
def visit_Ellipsis(self, node: Ellipsis) -> Any: ...
2026+
2027+
if sys.version_info < (3, 14):
2028+
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2029+
def visit_Num(self, node: Num) -> Any: ... # type: ignore[deprecated]
2030+
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2031+
def visit_Str(self, node: Str) -> Any: ... # type: ignore[deprecated]
2032+
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2033+
def visit_Bytes(self, node: Bytes) -> Any: ... # type: ignore[deprecated]
2034+
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2035+
def visit_NameConstant(self, node: NameConstant) -> Any: ... # type: ignore[deprecated]
2036+
@deprecated("Replaced by visit_Constant; removed in Python 3.14")
2037+
def visit_Ellipsis(self, node: Ellipsis) -> Any: ... # type: ignore[deprecated]
2038+
20312039

20322040
class NodeTransformer(NodeVisitor):
20332041
def generic_visit(self, node: AST) -> AST: ...

0 commit comments

Comments
 (0)