@@ -45,16 +45,19 @@ The module defines the following functions:
45
45
* if *tb * is not ``None ``, it prints a header ``Traceback (most recent
46
46
call last): ``
47
47
* it prints the exception *etype * and *value * after the stack trace
48
- * if *etype * is :exc: `SyntaxError ` and *value * has the appropriate format, it
49
- prints the line where the syntax error occurred with a caret indicating the
50
- approximate position of the error.
48
+ * if *type(value) * is :exc: `SyntaxError ` and *value * has the appropriate
49
+ format, it prints the line where the syntax error occurred with a caret
50
+ indicating the approximate position of the error.
51
51
52
52
The optional *limit * argument has the same meaning as for :func: `print_tb `.
53
53
If *chain * is true (the default), then chained exceptions (the
54
54
:attr: `__cause__ ` or :attr: `__context__ ` attributes of the exception) will be
55
55
printed as well, like the interpreter itself does when printing an unhandled
56
56
exception.
57
57
58
+ .. versionchanged :: 3.5
59
+ The *etype * argument is ignored and inferred from the type of *value *.
60
+
58
61
59
62
.. function :: print_exc(limit=None, file=None, chain=True)
60
63
@@ -131,6 +134,9 @@ The module defines the following functions:
131
134
containing internal newlines. When these lines are concatenated and printed,
132
135
exactly the same text is printed as does :func: `print_exception `.
133
136
137
+ .. versionchanged :: 3.5
138
+ The *etype * argument is ignored and inferred from the type of *value *.
139
+
134
140
135
141
.. function :: format_exc(limit=None, chain=True)
136
142
@@ -358,6 +364,7 @@ exception and traceback:
358
364
print("*** print_tb:")
359
365
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
360
366
print("* ** print_exception:")
367
+ # exc_type below is ignored on 3.5 and later
361
368
traceback.print_exception(exc_type, exc_value, exc_traceback,
362
369
limit=2, file=sys.stdout)
363
370
print("*** print_exc:")
@@ -367,6 +374,7 @@ exception and traceback:
367
374
print(formatted_lines[0])
368
375
print(formatted_lines[-1])
369
376
print("*** format_exception:")
377
+ # exc_type below is ignored on 3.5 and later
370
378
print(repr(traceback.format_exception(exc_type, exc_value,
371
379
exc_traceback)))
372
380
print("* ** extract_tb:")
0 commit comments