This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: traceback.print_tb() takes `tb`, not `traceback` as a keyword argument
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: docs@python, martin.panter, nchammas, orsenthil, python-dev, upendra-k14
Priority: normal Keywords: easy, patch

Created on 2016-01-07 04:47 by nchammas, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
func_args_name.patch upendra-k14, 2016-01-08 09:58
Messages (6)
msg257670 - (view) Author: Nicholas Chammas (nchammas) * Date: 2016-01-07 04:47
Here is traceback.print_tb()'s signature [0]:

```
def print_tb(tb, limit=None, file=None):
```

However, its documentation reads [1]:

```
.. function:: print_tb(traceback, limit=None, file=None)
```

Did the keyword argument change recently, or was this particular doc always wrong?

[0] https://github.com/python/cpython/blob/1fe0fd9feb6a4472a9a1b186502eb9c0b2366326/Lib/traceback.py#L43
[1] https://raw.githubusercontent.com/python/cpython/1fe0fd9feb6a4472a9a1b186502eb9c0b2366326/Doc/library/traceback.rst
msg257673 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-07 06:13
According to the history, the parameter was always called “tb” in the implementation <https://hg.python.org/cpython/annotate/93df83022be8/Lib/traceback.py#l7>, and the documentation always had it wrong <https://hg.python.org/cpython/annotate/1c29f6bdd898/Doc/lib/libtraceback.tex#l18>. So I would change the documentation to “tb”.

It looks like other functions in this module have the wrong parameter names also.
msg257747 - (view) Author: Upendra Kumar (upendra-k14) * Date: 2016-01-08 09:58
I am submitting a patch for this documentation issue. I have changed the function parameters name 'traceback' to 'tb'. Because of this I have also introduced changes in the text of the documentation to maintain coherency.

I found some more inconsistent function parameter's name:

I have changed them :

'type' to 'etype' in functions print_exception, format_exception_only, format_exception

'list' to 'extracted_list' in function format_list
'
msg258362 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-16 05:46
New changeset e40f6c3dc114 by Senthil Kumaran in branch '3.5':
Issue26035 - Correct the argument names used in the docs of the traceback module. Make it consistent with module args.
https://hg.python.org/cpython/rev/e40f6c3dc114

New changeset e96c1491896d by Senthil Kumaran in branch 'default':
Merge from 3.5
https://hg.python.org/cpython/rev/e96c1491896d
msg258364 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-16 06:13
New changeset daff4ced1b32 by Senthil Kumaran in branch '2.7':
Issue26035 - Correct the argument names used in the docs of the traceback module. Make it consistent with module args.
https://hg.python.org/cpython/rev/daff4ced1b32
msg258365 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2016-01-16 06:14
Thanks for the patch, Upendra Kumar. It's fixed now. Appreciate your taking care of other args and making the change meaningful.
History
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70223
2016-01-16 06:14:51orsenthilsetstatus: open -> closed

type: behavior
assignee: docs@python -> orsenthil

nosy: + orsenthil
messages: + msg258365
resolution: fixed
stage: needs patch -> resolved
2016-01-16 06:13:24python-devsetmessages: + msg258364
2016-01-16 05:46:17python-devsetnosy: + python-dev
messages: + msg258362
2016-01-08 09:58:06upendra-k14setfiles: + func_args_name.patch

nosy: + upendra-k14
messages: + msg257747

keywords: + patch
2016-01-07 08:45:29berker.peksagsetkeywords: + easy
2016-01-07 06:13:07martin.pantersetversions: + Python 2.7
nosy: + martin.panter

messages: + msg257673

stage: needs patch
2016-01-07 04:47:35nchammascreate