@@ -12,6 +12,7 @@ from collections.abc import (
1212 Iterator ,
1313 KeysView ,
1414 Mapping ,
15+ MutableMapping ,
1516 MutableSequence ,
1617 ValuesView ,
1718)
@@ -62,6 +63,9 @@ if sys.version_info >= (3, 12):
6263if sys .version_info >= (3 , 13 ):
6364 __all__ += ["CapsuleType" ]
6465
66+ if sys .version_info >= (3 , 15 ):
67+ __all__ += ["FrameLocalsProxyType" , "LazyImportType" ]
68+
6569# Note, all classes "defined" here require special handling.
6670
6771_T1 = TypeVar ("_T1" )
@@ -149,9 +153,11 @@ class CodeType:
149153 def co_name (self ) -> str : ...
150154 @property
151155 def co_firstlineno (self ) -> int : ...
152- @property
153- @deprecated ("Deprecated since Python 3.10; will be removed in Python 3.15. Use `CodeType.co_lines()` instead." )
154- def co_lnotab (self ) -> bytes : ...
156+ if sys .version_info < (3 , 15 ):
157+ @property
158+ @deprecated ("Deprecated since Python 3.10; will be removed in Python 3.15. Use `CodeType.co_lines()` instead." )
159+ def co_lnotab (self ) -> bytes : ...
160+
155161 @property
156162 def co_freevars (self ) -> tuple [str , ...]: ...
157163 @property
@@ -360,6 +366,9 @@ class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]):
360366 if sys .version_info >= (3 , 11 ):
361367 @property
362368 def gi_suspended (self ) -> bool : ...
369+ if sys .version_info >= (3 , 15 ):
370+ @property
371+ def gi_state (self ) -> Literal ["GEN_CREATED" , "GEN_SUSPENDED" , "GEN_RUNNING" , "GEN_CLOSED" ]: ...
363372 __name__ : str
364373 __qualname__ : str
365374 def __iter__ (self ) -> Self : ...
@@ -389,6 +398,9 @@ class AsyncGeneratorType(AsyncGenerator[_YieldT_co, _SendT_contra]):
389398 if sys .version_info >= (3 , 12 ):
390399 @property
391400 def ag_suspended (self ) -> bool : ...
401+ if sys .version_info >= (3 , 15 ):
402+ @property
403+ def ag_state (self ) -> Literal ["AGEN_CREATED" , "AGEN_SUSPENDED" , "AGEN_RUNNING" , "AGEN_CLOSED" ]: ...
392404
393405 def __aiter__ (self ) -> Self : ...
394406 def __anext__ (self ) -> Coroutine [Any , Any , _YieldT_co ]: ...
@@ -423,6 +435,9 @@ class CoroutineType(Coroutine[_YieldT_co, _SendT_nd_contra, _ReturnT_nd_co]):
423435 if sys .version_info >= (3 , 11 ):
424436 @property
425437 def cr_suspended (self ) -> bool : ...
438+ if sys .version_info >= (3 , 15 ):
439+ @property
440+ def cr_state (self ) -> Literal ["CORO_CREATED" , "CORO_SUSPENDED" , "CORO_RUNNING" , "CORO_CLOSED" ]: ...
426441
427442 def close (self ) -> None : ...
428443 def __await__ (self ) -> Generator [Any , None , _ReturnT_nd_co ]: ...
@@ -552,8 +567,12 @@ class FrameType:
552567 # An `int | None` annotation here causes too many false-positive errors, so applying `int | Any`.
553568 @property
554569 def f_lineno (self ) -> int | MaybeNone : ...
555- @property
556- def f_locals (self ) -> dict [str , Any ]: ...
570+ if sys .version_info >= (3 , 15 ):
571+ @property
572+ def f_locals (self ) -> FrameLocalsProxyType | dict [str , Any ]: ...
573+ else :
574+ @property
575+ def f_locals (self ) -> dict [str , Any ]: ...
557576 f_trace : Callable [[FrameType , str , Any ], Any ] | None
558577 f_trace_lines : bool
559578 f_trace_opcodes : bool
@@ -562,6 +581,28 @@ class FrameType:
562581 @property
563582 def f_generator (self ) -> GeneratorType [Any , Any , Any ] | CoroutineType [Any , Any , Any ] | None : ...
564583
584+ if sys .version_info >= (3 , 15 ):
585+ @final
586+ class FrameLocalsProxyType (MutableMapping [str , Any ]):
587+ def __new__ (cls , frame : FrameType , / ) -> Self : ...
588+ def __getitem__ (self , key : str , / ) -> Any : ...
589+ def __setitem__ (self , key : str , value : Any , / ) -> None : ...
590+ def __delitem__ (self , key : str , / ) -> None : ...
591+ def __iter__ (self ) -> Iterator [str ]: ...
592+ def __len__ (self ) -> int : ...
593+ def __contains__ (self , key : object , / ) -> bool : ...
594+ def __reversed__ (self ) -> Iterator [str ]: ...
595+ def copy (self ) -> dict [str , Any ]: ...
596+ def pop (self , key : str , default : Any = ..., / ) -> Any : ...
597+ def setdefault (self , key : str , default : Any = ..., / ) -> Any : ...
598+ def update (self , object : SupportsKeysAndGetItem [str , Any ] | Iterable [tuple [str , Any ]], / ) -> None : ... # type: ignore[override]
599+
600+ @final
601+ class LazyImportType :
602+ @property
603+ def __name__ (self ) -> str : ...
604+ def resolve (self ) -> Any : ...
605+
565606@final
566607class GetSetDescriptorType :
567608 @property
0 commit comments