@@ -1096,8 +1096,16 @@ class Constant(expr):
10961096 kind : str | None
10971097 if sys .version_info < (3 , 14 ):
10981098 # Aliases for value, for backwards compatibility
1099- s : _ConstantValue
1100- n : _ConstantValue
1099+ @deprecated ("Will be removed in Python 3.14; use value instead" )
1100+ @property
1101+ def n (self ) -> _ConstantValue : ...
1102+ @n .setter
1103+ def n (self , value : _ConstantValue ) -> None : ...
1104+ @deprecated ("Will be removed in Python 3.14; use value instead" )
1105+ @property
1106+ def s (self ) -> _ConstantValue : ...
1107+ @s .setter
1108+ def s (self , value : _ConstantValue ) -> None : ...
11011109
11021110 def __init__ (self , value : _ConstantValue , kind : str | None = None , ** kwargs : Unpack [_Attributes ]) -> None : ...
11031111
@@ -1495,11 +1503,11 @@ if sys.version_info >= (3, 10):
14951503
14961504 class MatchSingleton (pattern ):
14971505 __match_args__ = ("value" ,)
1498- value : Literal [ True , False ] | None
1499- def __init__ (self , value : Literal [ True , False ] | None , ** kwargs : Unpack [_Attributes [int ]]) -> None : ...
1506+ value : bool | None
1507+ def __init__ (self , value : bool | None , ** kwargs : Unpack [_Attributes [int ]]) -> None : ...
15001508
15011509 if sys .version_info >= (3 , 14 ):
1502- def __replace__ (self , * , value : Literal [ True , False ] | None = ..., ** kwargs : Unpack [_Attributes [int ]]) -> Self : ...
1510+ def __replace__ (self , * , value : bool | None = ..., ** kwargs : Unpack [_Attributes [int ]]) -> Self : ...
15031511
15041512 class MatchSequence (pattern ):
15051513 __match_args__ = ("patterns" ,)
@@ -1696,25 +1704,23 @@ class _ABC(type):
16961704if sys .version_info < (3 , 14 ):
16971705 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
16981706 class Num (Constant , metaclass = _ABC ):
1699- value : int | float | complex
1707+ def __new__ ( cls , n : complex , ** kwargs : Unpack [ _Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17001708
17011709 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
17021710 class Str (Constant , metaclass = _ABC ):
1703- value : str
1704- # Aliases for value, for backwards compatibility
1705- s : str
1711+ def __new__ (cls , s : str , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17061712
17071713 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
17081714 class Bytes (Constant , metaclass = _ABC ):
1709- value : bytes
1710- # Aliases for value, for backwards compatibility
1711- s : bytes
1715+ def __new__ (cls , s : bytes , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17121716
17131717 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1714- class NameConstant (Constant , metaclass = _ABC ): ...
1718+ class NameConstant (Constant , metaclass = _ABC ):
1719+ def __new__ (cls , value : _ConstantValue , kind : str | None , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17151720
17161721 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1717- class Ellipsis (Constant , metaclass = _ABC ): ...
1722+ class Ellipsis (Constant , metaclass = _ABC ):
1723+ def __new__ (cls , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17181724
17191725# everything below here is defined in ast.py
17201726
@@ -1797,7 +1803,7 @@ if sys.version_info >= (3, 13):
17971803 type_comments : bool = False ,
17981804 feature_version : None | int | tuple [int , int ] = None ,
17991805 optimize : Literal [- 1 , 0 , 1 , 2 ] = - 1 ,
1800- ) -> AST : ...
1806+ ) -> mod : ...
18011807
18021808else :
18031809 @overload
@@ -1868,7 +1874,7 @@ else:
18681874 * ,
18691875 type_comments : bool = False ,
18701876 feature_version : None | int | tuple [int , int ] = None ,
1871- ) -> AST : ...
1877+ ) -> mod : ...
18721878
18731879def literal_eval (node_or_string : str | AST ) -> Any : ...
18741880
0 commit comments