Issue26035 - Correct the argument names used in the docs of the traceback module. Make it consistent with module args.

Patch contributed by Upendra Kumar.
This commit is contained in:
Senthil Kumaran 2016-01-15 21:45:17 -08:00
parent 7a5fe6d5d1
commit a82908f743
1 changed files with 35 additions and 34 deletions

View File

@ -20,29 +20,29 @@ the :data:`sys.last_traceback` variable and returned as the third item from
The module defines the following functions: The module defines the following functions:
.. function:: print_tb(traceback, limit=None, file=None) .. function:: print_tb(tb, limit=None, file=None)
Print up to *limit* stack trace entries from *traceback* (starting from Print up to *limit* stack trace entries from traceback object *tb* (starting
the caller's frame) if *limit* is positive. Otherwise, print the last from the caller's frame) if *limit* is positive. Otherwise, print the last
``abs(limit)`` entries. If *limit* is omitted or ``None``, all entries ``abs(limit)`` entries. If *limit* is omitted or ``None``, all entries are
are printed. If *file* is omitted or ``None``, the output goes to printed. If *file* is omitted or ``None``, the output goes to
``sys.stderr``; otherwise it should be an open file or file-like object ``sys.stderr``; otherwise it should be an open file or file-like object to
to receive the output. receive the output.
.. versionchanged:: 3.5 .. versionchanged:: 3.5
Added negative *limit* support. Added negative *limit* support.
.. function:: print_exception(type, value, traceback, limit=None, file=None, chain=True) .. function:: print_exception(etype, value, tb, limit=None, file=None, chain=True)
Print exception information and stack trace entries from Print exception information and stack trace entries from traceback object
*traceback* to *file*. This differs from :func:`print_tb` in the following *tb* to *file*. This differs from :func:`print_tb` in the following
ways: ways:
* if *traceback* 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 *type* and *value* after the stack trace * it prints the exception *etype* and *value* after the stack trace
* if *type* is :exc:`SyntaxError` and *value* has the appropriate format, it * if *etype* is :exc:`SyntaxError` and *value* has the appropriate format, it
prints the line where the syntax error occurred with a caret indicating the prints the line where the syntax error occurred with a caret indicating the
approximate position of the error. approximate position of the error.
@ -80,10 +80,10 @@ The module defines the following functions:
Added negative *limit* support. Added negative *limit* support.
.. function:: extract_tb(traceback, limit=None) .. function:: extract_tb(tb, limit=None)
Return a list of "pre-processed" stack trace entries extracted from the Return a list of "pre-processed" stack trace entries extracted from the
traceback object *traceback*. It is useful for alternate formatting of traceback object *tb*. It is useful for alternate formatting of
stack traces. The optional *limit* argument has the same meaning as for stack traces. The optional *limit* argument has the same meaning as for
:func:`print_tb`. A "pre-processed" stack trace entry is a 4-tuple :func:`print_tb`. A "pre-processed" stack trace entry is a 4-tuple
(*filename*, *line number*, *function name*, *text*) representing the (*filename*, *line number*, *function name*, *text*) representing the
@ -99,39 +99,40 @@ The module defines the following functions:
arguments have the same meaning as for :func:`print_stack`. arguments have the same meaning as for :func:`print_stack`.
.. function:: format_list(list) .. function:: format_list(extracted_list)
Given a list of tuples as returned by :func:`extract_tb` or Given a list of tuples as returned by :func:`extract_tb` or
:func:`extract_stack`, return a list of strings ready for printing. Each string :func:`extract_stack`, return a list of strings ready for printing. Each
in the resulting list corresponds to the item with the same index in the string in the resulting list corresponds to the item with the same index in
argument list. Each string ends in a newline; the strings may contain internal the argument list. Each string ends in a newline; the strings may contain
newlines as well, for those items whose source text line is not ``None``. internal newlines as well, for those items whose source text line is not
``None``.
.. function:: format_exception_only(type, value) .. function:: format_exception_only(etype, value)
Format the exception part of a traceback. The arguments are the exception type Format the exception part of a traceback. The arguments are the exception
and value such as given by ``sys.last_type`` and ``sys.last_value``. The return type and value such as given by ``sys.last_type`` and ``sys.last_value``.
value is a list of strings, each ending in a newline. Normally, the list The return value is a list of strings, each ending in a newline. Normally,
contains a single string; however, for :exc:`SyntaxError` exceptions, it the list contains a single string; however, for :exc:`SyntaxError`
contains several lines that (when printed) display detailed information about exceptions, it contains several lines that (when printed) display detailed
where the syntax error occurred. The message indicating which exception information about where the syntax error occurred. The message indicating
occurred is the always last string in the list. which exception occurred is the always last string in the list.
.. function:: format_exception(type, value, tb, limit=None, chain=True) .. function:: format_exception(etype, value, tb, limit=None, chain=True)
Format a stack trace and the exception information. The arguments have the Format a stack trace and the exception information. The arguments have the
same meaning as the corresponding arguments to :func:`print_exception`. The same meaning as the corresponding arguments to :func:`print_exception`. The
return value is a list of strings, each ending in a newline and some containing return value is a list of strings, each ending in a newline and some
internal newlines. When these lines are concatenated and printed, exactly the containing internal newlines. When these lines are concatenated and printed,
same text is printed as does :func:`print_exception`. exactly the same text is printed as does :func:`print_exception`.
.. function:: format_exc(limit=None, chain=True) .. function:: format_exc(limit=None, chain=True)
This is like ``print_exc(limit)`` but returns a string instead of printing to a This is like ``print_exc(limit)`` but returns a string instead of printing to
file. a file.
.. function:: format_tb(tb, limit=None) .. function:: format_tb(tb, limit=None)