[Python-checkins] cpython (2.7): Issue26035 - Correct the argument names used in the docs of the traceback
senthil.kumaran
python-checkins at python.org
Sat Jan 16 01:13:22 EST 2016
https://hg.python.org/cpython/rev/daff4ced1b32
changeset: 99924:daff4ced1b32
branch: 2.7
parent: 99919:8b8ac7adbf49
user: Senthil Kumaran <senthil at uthcode.com>
date: Fri Jan 15 22:13:16 2016 -0800
summary:
Issue26035 - Correct the argument names used in the docs of the traceback module. Make it consistent with module args.
files:
Doc/library/traceback.rst | 99 +++++++++++++-------------
1 files changed, 51 insertions(+), 48 deletions(-)
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst
--- a/Doc/library/traceback.rst
+++ b/Doc/library/traceback.rst
@@ -14,29 +14,30 @@
.. index:: object: traceback
The module uses traceback objects --- this is the object type that is stored in
-the variables :data:`sys.exc_traceback` (deprecated) and :data:`sys.last_traceback` and
-returned as the third item from :func:`sys.exc_info`.
+the variables :data:`sys.exc_traceback` (deprecated) and
+:data:`sys.last_traceback` and returned as the third item from
+:func:`sys.exc_info`.
The module defines the following functions:
-.. function:: print_tb(traceback[, limit[, file]])
+.. function:: print_tb(tb[, limit[, file]])
- Print up to *limit* stack trace entries from *traceback*. If *limit* is omitted
- or ``None``, all entries are printed. If *file* is omitted or ``None``, the
- output goes to ``sys.stderr``; otherwise it should be an open file or file-like
- object to receive the output.
+ Print up to *limit* stack trace entries from the traceback object *tb*. If
+ *limit* is omitted or ``None``, all entries are printed. If *file* is omitted
+ or ``None``, the output goes to ``sys.stderr``; otherwise it should be an
+ open file or file-like object to receive the output.
-.. function:: print_exception(type, value, traceback[, limit[, file]])
+.. function:: print_exception(etype, value, tb[, limit[, file]])
- Print exception information and up to *limit* stack trace entries from
- *traceback* to *file*. This differs from :func:`print_tb` in the following ways:
- (1) if *traceback* is not ``None``, it prints a header ``Traceback (most recent
- call last):``; (2) it prints the exception *type* and *value* after the stack
- trace; (3) if *type* is :exc:`SyntaxError` and *value* has the appropriate
- format, it prints the line where the syntax error occurred with a caret
- indicating the approximate position of the error.
+ Print exception information and up to *limit* stack trace entries from the
+ traceback *tb* to *file*. This differs from :func:`print_tb` in the following
+ ways: (1) if *tb* is not ``None``, it prints a header ``Traceback (most
+ recent call last):``; (2) it prints the exception *etype* and *value* after
+ the stack trace; (3) 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 approximate position of the error.
.. function:: print_exc([limit[, file]])
@@ -49,8 +50,8 @@
.. function:: format_exc([limit])
- This is like ``print_exc(limit)`` but returns a string instead of printing to a
- file.
+ This is like ``print_exc(limit)`` but returns a string instead of printing to
+ a file.
.. versionadded:: 2.4
@@ -64,21 +65,21 @@
.. function:: print_stack([f[, limit[, file]]])
- This function prints a stack trace from its invocation point. The optional *f*
- argument can be used to specify an alternate stack frame to start. The optional
- *limit* and *file* arguments have the same meaning as for
+ This function prints a stack trace from its invocation point. The optional
+ *f* argument can be used to specify an alternate stack frame to start. The
+ optional limit* and *file* arguments have the same meaning as for
:func:`print_exception`.
-.. function:: extract_tb(traceback[, limit])
+.. function:: extract_tb(tb[, limit])
Return a list of up to *limit* "pre-processed" stack trace entries extracted
- from the traceback object *traceback*. It is useful for alternate formatting of
- stack traces. If *limit* is omitted or ``None``, all entries are extracted. A
- "pre-processed" stack trace entry is a 4-tuple (*filename*, *line number*,
- *function name*, *text*) representing the information that is usually printed
- for a stack trace. The *text* is a string with leading and trailing whitespace
- stripped; if the source is not available it is ``None``.
+ from the traceback object *tb*. It is useful for alternate formatting of
+ stack traces. If *limit* is omitted or ``None``, all entries are extracted.
+ A "pre-processed" stack trace entry is a 4-tuple (*filename*, *line number*,
+ function name*, *text*) representing the information that is usually printed
+ for a stack trace. The *text* is a string with leading and trailing
+ whitespace stripped; if the source is not available it is ``None``.
.. function:: extract_stack([f[, limit]])
@@ -88,33 +89,35 @@
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
- :func:`extract_stack`, return a list of strings ready for printing. Each string
- in the resulting list corresponds to the item with the same index in the
- argument list. Each string ends in a newline; the strings may contain internal
- newlines as well, for those items whose source text line is not ``None``.
+ :func:`extract_stack`, return a list of strings ready for printing. Each
+ string in the resulting list corresponds to the item with the same index in
+ the argument list. Each string ends in a newline; the strings may contain
+ 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
- and value such as given by ``sys.last_type`` and ``sys.last_value``. The return
- value is a list of strings, each ending in a newline. Normally, the list
- contains a single string; however, for :exc:`SyntaxError` exceptions, it
- contains several lines that (when printed) display detailed information about
- where the syntax error occurred. The message indicating which exception
- occurred is the always last string in the list.
+ Format the exception part of a traceback. The arguments are the exception
+ type, *etype* and *value* such as given by ``sys.last_type`` and
+ ``sys.last_value``. The return value is a list of strings, each ending in a
+ newline. Normally, the list contains a single string; however, for
+ :exc:`SyntaxError` exceptions, it contains several lines that (when printed)
+ display detailed information about where the syntax error occurred. The
+ message indicating which exception occurred is the always last string in the
+ list.
-.. function:: format_exception(type, value, tb[, limit])
+.. function:: format_exception(etype, value, tb[, limit])
Format a stack trace and the exception information. The arguments have 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
- internal newlines. When these lines are concatenated and printed, exactly the
- same text is printed as does :func:`print_exception`.
+ return value is a list of strings, each ending in a newline and some
+ containing internal newlines. When these lines are concatenated and printed,
+ exactly the same text is printed as does :func:`print_exception`.
.. function:: format_tb(tb[, limit])
@@ -129,10 +132,10 @@
.. function:: tb_lineno(tb)
- This function returns the current line number set in the traceback object. This
- function was necessary because in versions of Python prior to 2.3 when the
- :option:`-O` flag was passed to Python the ``tb.tb_lineno`` was not updated
- correctly. This function has no use in versions past 2.3.
+ This function returns the current line number set in the traceback object.
+ This function was necessary because in versions of Python prior to 2.3 when
+ the :option:`-O` flag was passed to Python the ``tb.tb_lineno`` was not
+ updated correctly. This function has no use in versions past 2.3.
.. _traceback-example:
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list