gh-145896: Fix typos and stale docstrings in Lib/traceback.py#145897
gh-145896: Fix typos and stale docstrings in Lib/traceback.py#145897devdanzin wants to merge 6 commits into
Lib/traceback.py#145897Conversation
picnixz
left a comment
There was a problem hiding this comment.
Can you also check that any public doc matches this one (or is as long as the internal one) please?
|
Not sure what you mean by "is as long as the internal one", but I've corrected the same staleness and some typos in the traceback public documentation. |
|
By "as long as", I meant that we were precise enough in the public docs |
|
This PR is stale because it has been open for 30 days with no activity. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
In general LGTM. I suggest to remove lists of FrameSummary's attribute names where we have a reference to FrameSummary,
| :attr:`~FrameSummary.filename`, :attr:`~FrameSummary.lineno`, | ||
| :attr:`~FrameSummary.name`, and :attr:`~FrameSummary.line` representing the | ||
| :attr:`~FrameSummary.name`, :attr:`~FrameSummary.line`, | ||
| :attr:`~FrameSummary.end_lineno`, :attr:`~FrameSummary.colno`, and |
There was a problem hiding this comment.
This is not correct, because end_lineno, colno and end_colno are not printed for a stack trace. They are used to draw the caret and underscores, but only values mentioned above are directly printed.
I do not think it is worth to enumerate the printed attributes here. We have a reference to FrameSummary which contains descriptions of all attributes. I think we can remove all attribute names here.
| representing the information that is usually printed for a stack | ||
| trace. The line is a string with leading and trailing | ||
| whitespace stripped; if the source is not available it is None. | ||
| containing attributes filename, lineno, name, line, end_lineno, |
There was a problem hiding this comment.
As above, I suggest to remove the enumeration of attributes. They are available in the FrameSummary docs.
Documentation build overview
|
…finition with all attributes.
|
Thank for the review! I've removed the enumerations and adapted the wording so e.g. the reference to "line" makes it clear it's an attribute. I've avoided reflowing the text as per Bénédikt's request (makes it easier to review), please let me know whether I should reflow for the final commit. |
This PR fixes some typos and stale docstrings, as described by Claude Code:
extract_tb()docstring: addend_lineno,colno, andend_colnoto the listedFrameSummaryattributes (available since 3.11)extract_stack()docstring: replace outdated "quadruple (filename, line number, function name, text)" with "FrameSummary object" (stale since 3.5)FrameSummaryclass docstring:"for the of code"→"for the code"_display_width()docstring:"extra amount of width"→"amount of width"(the function returns total display width, not a delta)TracebackException.__init__comment:"exc_traceback, exc_value, exc_traceback"→"exc_type, exc_value, exc_traceback"Lib/traceback.py#145896