@@ -96,6 +96,12 @@ def clear_frames(tb: TracebackType) -> None: ...
9696def walk_stack (f : FrameType | None ) -> Iterator [tuple [FrameType , int ]]: ...
9797def walk_tb (tb : TracebackType | None ) -> Iterator [tuple [FrameType , int ]]: ...
9898
99+ if sys .version_info >= (3 , 11 ):
100+ class _ExceptionPrintContext :
101+ def __init__ (self ) -> None : ...
102+ def indent (self ) -> str : ...
103+ def emit (self , text_gen : str | Iterable [str ], margin_char : str | None = ...) -> Generator [str , None , None ]: ...
104+
99105class TracebackException :
100106 __cause__ : TracebackException
101107 __context__ : TracebackException
@@ -107,7 +113,34 @@ class TracebackException:
107113 text : str
108114 offset : int
109115 msg : str
110- if sys .version_info >= (3 , 10 ):
116+ if sys .version_info >= (3 , 11 ):
117+ def __init__ (
118+ self ,
119+ exc_type : type [BaseException ],
120+ exc_value : BaseException ,
121+ exc_traceback : TracebackType | None ,
122+ * ,
123+ limit : int | None = ...,
124+ lookup_lines : bool = ...,
125+ capture_locals : bool = ...,
126+ compact : bool = ...,
127+ max_group_width : int = ...,
128+ max_group_depth : int = ...,
129+ _seen : set [int ] | None = ...,
130+ ) -> None : ...
131+ @classmethod
132+ def from_exception (
133+ cls : type [Self ],
134+ exc : BaseException ,
135+ * ,
136+ limit : int | None = ...,
137+ lookup_lines : bool = ...,
138+ capture_locals : bool = ...,
139+ compact : bool = ...,
140+ max_group_width : int = ...,
141+ max_group_depth : int = ...,
142+ ) -> Self : ...
143+ elif sys .version_info >= (3 , 10 ):
111144 def __init__ (
112145 self ,
113146 exc_type : type [BaseException ],
@@ -148,9 +181,16 @@ class TracebackException:
148181 ) -> Self : ...
149182
150183 def __eq__ (self , other : object ) -> bool : ...
151- def format (self , * , chain : bool = ...) -> Generator [str , None , None ]: ...
184+ if sys .version_info >= (3 , 11 ):
185+ def format (self , * , chain : bool = ..., _ctx : _ExceptionPrintContext | None = ...) -> Generator [str , None , None ]: ...
186+ else :
187+ def format (self , * , chain : bool = ...) -> Generator [str , None , None ]: ...
188+
152189 def format_exception_only (self ) -> Generator [str , None , None ]: ...
153190
191+ if sys .version_info >= (3 , 11 ):
192+ def print (self , * , file : SupportsWrite [str ] | None = ..., chain : bool = ...) -> None : ...
193+
154194class FrameSummary (Iterable [Any ]):
155195 if sys .version_info >= (3 , 11 ):
156196 def __init__ (
@@ -213,4 +253,7 @@ class StackSummary(list[FrameSummary]):
213253 ) -> StackSummary : ...
214254 @classmethod
215255 def from_list (cls , a_list : list [_PT ]) -> StackSummary : ...
256+ if sys .version_info >= (3 , 11 ):
257+ def format_frame_summary (self , frame_summary : FrameSummary ) -> str : ...
258+
216259 def format (self ) -> list [str ]: ...
0 commit comments