Skip to content

Commit cca3d4a

Browse files
CarreauMariatta
authored andcommitted
bpo-29660: traceback: Document that etype is ignored in some places. (GH-344) (GH-1914)
(cherry picked from commit cdb89cd)
1 parent e20d226 commit cca3d4a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Doc/library/traceback.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,19 @@ The module defines the following functions:
4545
* if *tb* is not ``None``, it prints a header ``Traceback (most recent
4646
call last):``
4747
* 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.
5151

5252
The optional *limit* argument has the same meaning as for :func:`print_tb`.
5353
If *chain* is true (the default), then chained exceptions (the
5454
:attr:`__cause__` or :attr:`__context__` attributes of the exception) will be
5555
printed as well, like the interpreter itself does when printing an unhandled
5656
exception.
5757

58+
.. versionchanged:: 3.5
59+
The *etype* argument is ignored and inferred from the type of *value*.
60+
5861

5962
.. function:: print_exc(limit=None, file=None, chain=True)
6063

@@ -131,6 +134,9 @@ The module defines the following functions:
131134
containing internal newlines. When these lines are concatenated and printed,
132135
exactly the same text is printed as does :func:`print_exception`.
133136

137+
.. versionchanged:: 3.5
138+
The *etype* argument is ignored and inferred from the type of *value*.
139+
134140

135141
.. function:: format_exc(limit=None, chain=True)
136142

@@ -358,6 +364,7 @@ exception and traceback:
358364
print("*** print_tb:")
359365
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
360366
print("*** print_exception:")
367+
# exc_type below is ignored on 3.5 and later
361368
traceback.print_exception(exc_type, exc_value, exc_traceback,
362369
limit=2, file=sys.stdout)
363370
print("*** print_exc:")
@@ -367,6 +374,7 @@ exception and traceback:
367374
print(formatted_lines[0])
368375
print(formatted_lines[-1])
369376
print("*** format_exception:")
377+
# exc_type below is ignored on 3.5 and later
370378
print(repr(traceback.format_exception(exc_type, exc_value,
371379
exc_traceback)))
372380
print("*** extract_tb:")

0 commit comments

Comments
 (0)