bpo-29660: traceback: Document that etype is ignored in some places. (GH-344)

This commit is contained in:
Matthias Bussonnier 2017-06-01 14:54:01 -07:00 committed by Mariatta
parent c9ccacea3f
commit cdb89cd72c
1 changed files with 11 additions and 3 deletions

View File

@ -45,9 +45,9 @@ The module defines the following functions:
* if *tb* is not ``None``, it prints a header ``Traceback (most recent * if *tb* is not ``None``, it prints a header ``Traceback (most recent
call last):`` call last):``
* it prints the exception *etype* and *value* after the stack trace * it prints the exception *etype* and *value* after the stack trace
* if *etype* is :exc:`SyntaxError` and *value* has the appropriate format, it * if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate
prints the line where the syntax error occurred with a caret indicating the format, it prints the line where the syntax error occurred with a caret
approximate position of the error. indicating the approximate position of the error.
The optional *limit* argument has the same meaning as for :func:`print_tb`. The optional *limit* argument has the same meaning as for :func:`print_tb`.
If *chain* is true (the default), then chained exceptions (the If *chain* is true (the default), then chained exceptions (the
@ -55,6 +55,9 @@ The module defines the following functions:
printed as well, like the interpreter itself does when printing an unhandled printed as well, like the interpreter itself does when printing an unhandled
exception. exception.
.. versionchanged:: 3.5
The *etype* argument is ignored and inferred from the type of *value*.
.. function:: print_exc(limit=None, file=None, chain=True) .. function:: print_exc(limit=None, file=None, chain=True)
@ -131,6 +134,9 @@ The module defines the following functions:
containing internal newlines. When these lines are concatenated and printed, containing internal newlines. When these lines are concatenated and printed,
exactly the same text is printed as does :func:`print_exception`. exactly the same text is printed as does :func:`print_exception`.
.. versionchanged:: 3.5
The *etype* argument is ignored and inferred from the type of *value*.
.. function:: format_exc(limit=None, chain=True) .. function:: format_exc(limit=None, chain=True)
@ -372,6 +378,7 @@ exception and traceback:
print("*** print_tb:") print("*** print_tb:")
traceback.print_tb(exc_traceback, limit=1, file=sys.stdout) traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
print("*** print_exception:") print("*** print_exception:")
# exc_type below is ignored on 3.5 and later
traceback.print_exception(exc_type, exc_value, exc_traceback, traceback.print_exception(exc_type, exc_value, exc_traceback,
limit=2, file=sys.stdout) limit=2, file=sys.stdout)
print("*** print_exc:") print("*** print_exc:")
@ -381,6 +388,7 @@ exception and traceback:
print(formatted_lines[0]) print(formatted_lines[0])
print(formatted_lines[-1]) print(formatted_lines[-1])
print("*** format_exception:") print("*** format_exception:")
# exc_type below is ignored on 3.5 and later
print(repr(traceback.format_exception(exc_type, exc_value, print(repr(traceback.format_exception(exc_type, exc_value,
exc_traceback))) exc_traceback)))
print("*** extract_tb:") print("*** extract_tb:")