@@ -3,7 +3,7 @@ from _typeshed import SupportsWrite, Unused
3
3
from collections .abc import Generator , Iterable , Iterator , Mapping
4
4
from types import FrameType , TracebackType
5
5
from typing import Any , Literal , overload
6
- from typing_extensions import Self , TypeAlias
6
+ from typing_extensions import Self , TypeAlias , deprecated
7
7
8
8
__all__ = [
9
9
"extract_stack" ,
@@ -85,7 +85,13 @@ def format_list(extracted_list: Iterable[FrameSummary | _FrameSummaryTuple]) ->
85
85
# undocumented
86
86
def print_list (extracted_list : Iterable [FrameSummary | _FrameSummaryTuple ], file : SupportsWrite [str ] | None = None ) -> None : ...
87
87
88
- if sys .version_info >= (3 , 10 ):
88
+ if sys .version_info >= (3 , 13 ):
89
+ @overload
90
+ def format_exception_only (exc : BaseException | None , / , * , show_group : bool = False ) -> list [str ]: ...
91
+ @overload
92
+ def format_exception_only (exc : Unused , / , value : BaseException | None , * , show_group : bool = False ) -> list [str ]: ...
93
+
94
+ elif sys .version_info >= (3 , 10 ):
89
95
@overload
90
96
def format_exception_only (exc : BaseException | None , / ) -> list [str ]: ...
91
97
@overload
@@ -111,13 +117,20 @@ class TracebackException:
111
117
__context__ : TracebackException
112
118
__suppress_context__ : bool
113
119
stack : StackSummary
114
- exc_type : type [BaseException ]
115
120
filename : str
116
121
lineno : int
117
122
text : str
118
123
offset : int
119
124
msg : str
120
- if sys .version_info >= (3 , 11 ):
125
+ if sys .version_info >= (3 , 13 ):
126
+ @property
127
+ def exc_type_str (self ) -> str : ...
128
+ @property
129
+ @deprecated ("Deprecated in 3.13. Use exc_type_str instead." )
130
+ def exc_type (self ) -> type [BaseException ] | None : ...
131
+ else :
132
+ exc_type : type [BaseException ]
133
+ if sys .version_info >= (3 , 13 ):
121
134
def __init__ (
122
135
self ,
123
136
exc_type : type [BaseException ],
@@ -130,20 +143,24 @@ class TracebackException:
130
143
compact : bool = False ,
131
144
max_group_width : int = 15 ,
132
145
max_group_depth : int = 10 ,
146
+ save_exc_type : bool = True ,
133
147
_seen : set [int ] | None = None ,
134
148
) -> None : ...
135
- @classmethod
136
- def from_exception (
137
- cls ,
138
- exc : BaseException ,
149
+ elif sys .version_info >= (3 , 11 ):
150
+ def __init__ (
151
+ self ,
152
+ exc_type : type [BaseException ],
153
+ exc_value : BaseException ,
154
+ exc_traceback : TracebackType | None ,
139
155
* ,
140
156
limit : int | None = None ,
141
157
lookup_lines : bool = True ,
142
158
capture_locals : bool = False ,
143
159
compact : bool = False ,
144
160
max_group_width : int = 15 ,
145
161
max_group_depth : int = 10 ,
146
- ) -> Self : ...
162
+ _seen : set [int ] | None = None ,
163
+ ) -> None : ...
147
164
elif sys .version_info >= (3 , 10 ):
148
165
def __init__ (
149
166
self ,
@@ -157,6 +174,20 @@ class TracebackException:
157
174
compact : bool = False ,
158
175
_seen : set [int ] | None = None ,
159
176
) -> None : ...
177
+ else :
178
+ def __init__ (
179
+ self ,
180
+ exc_type : type [BaseException ],
181
+ exc_value : BaseException ,
182
+ exc_traceback : TracebackType | None ,
183
+ * ,
184
+ limit : int | None = None ,
185
+ lookup_lines : bool = True ,
186
+ capture_locals : bool = False ,
187
+ _seen : set [int ] | None = None ,
188
+ ) -> None : ...
189
+
190
+ if sys .version_info >= (3 , 11 ):
160
191
@classmethod
161
192
def from_exception (
162
193
cls ,
@@ -166,19 +197,21 @@ class TracebackException:
166
197
lookup_lines : bool = True ,
167
198
capture_locals : bool = False ,
168
199
compact : bool = False ,
200
+ max_group_width : int = 15 ,
201
+ max_group_depth : int = 10 ,
169
202
) -> Self : ...
170
- else :
171
- def __init__ (
172
- self ,
173
- exc_type : type [BaseException ],
174
- exc_value : BaseException ,
175
- exc_traceback : TracebackType | None ,
203
+ elif sys .version_info >= (3 , 10 ):
204
+ @classmethod
205
+ def from_exception (
206
+ cls ,
207
+ exc : BaseException ,
176
208
* ,
177
209
limit : int | None = None ,
178
210
lookup_lines : bool = True ,
179
211
capture_locals : bool = False ,
180
- _seen : set [int ] | None = None ,
181
- ) -> None : ...
212
+ compact : bool = False ,
213
+ ) -> Self : ...
214
+ else :
182
215
@classmethod
183
216
def from_exception (
184
217
cls , exc : BaseException , * , limit : int | None = None , lookup_lines : bool = True , capture_locals : bool = False
@@ -190,7 +223,10 @@ class TracebackException:
190
223
else :
191
224
def format (self , * , chain : bool = True ) -> Generator [str , None , None ]: ...
192
225
193
- def format_exception_only (self ) -> Generator [str , None , None ]: ...
226
+ if sys .version_info >= (3 , 13 ):
227
+ def format_exception_only (self , * , show_group : bool = False , _depth : int = 0 ) -> Generator [str , None , None ]: ...
228
+ else :
229
+ def format_exception_only (self ) -> Generator [str , None , None ]: ...
194
230
195
231
if sys .version_info >= (3 , 11 ):
196
232
def print (self , * , file : SupportsWrite [str ] | None = None , chain : bool = True ) -> None : ...
0 commit comments