Skip to content

Commit e417d12

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

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

@@ -372,6 +378,7 @@ exception and traceback:
372378
print("*** print_tb:")
373379
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
374380
print("*** print_exception:")
381+
# exc_type below is ignored on 3.5 and later
375382
traceback.print_exception(exc_type, exc_value, exc_traceback,
376383
limit=2, file=sys.stdout)
377384
print("*** print_exc:")
@@ -381,6 +388,7 @@ exception and traceback:
381388
print(formatted_lines[0])
382389
print(formatted_lines[-1])
383390
print("*** format_exception:")
391+
# exc_type below is ignored on 3.5 and later
384392
print(repr(traceback.format_exception(exc_type, exc_value,
385393
exc_traceback)))
386394
print("*** extract_tb:")

0 commit comments

Comments
 (0)