@@ -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
@@ -1696,27 +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
1700- # Aliases for value, for backwards compatibility
1701- n : int | float | complex
1707+ def __new__ (cls , n : complex , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17021708
17031709 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
17041710 class Str (Constant , metaclass = _ABC ):
1705- value : str
1706- # Aliases for value, for backwards compatibility
1707- s : str
1711+ def __new__ (cls , s : str , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17081712
17091713 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
17101714 class Bytes (Constant , metaclass = _ABC ):
1711- value : bytes
1712- # Aliases for value, for backwards compatibility
1713- s : bytes
1715+ def __new__ (cls , s : bytes , ** kwargs : Unpack [_Attributes ]) -> Constant : ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
17141716
17151717 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1716- 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]
17171720
17181721 @deprecated ("Replaced by ast.Constant; removed in Python 3.14" )
1719- 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]
17201724
17211725# everything below here is defined in ast.py
17221726
0 commit comments