Skip to content

Commit 6bb5450

Browse files
methanebrianschuberthugovk
authored
Apply suggestions from code review
Co-authored-by: Brian Schubert <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent abaa598 commit 6bb5450

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

Doc/library/traceback.rst

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Module-Level Functions
6363
:term:`file <file object>` or :term:`file-like object` to
6464
receive the output.
6565

66-
If *show_lines* is false, source code lines are not included in the output.
66+
If *show_lines* is true (the default), source code lines will be included in the output.
6767

6868
If *recent_first* is true, the most recent stack trace entries are printed
6969
first, otherwise the oldest entries are printed first. The default is false.
@@ -121,7 +121,7 @@ Module-Level Functions
121121
printed as well, like the interpreter itself does when printing an unhandled
122122
exception.
123123

124-
If *show_lines* is false, source code lines are not included in the output.
124+
If *show_lines* is true, source code lines are included in the output.
125125

126126
If *recent_first* is true, the most recent stack trace entries are printed
127127
first, otherwise the oldest entries are printed first. The default is false.
@@ -165,8 +165,8 @@ Module-Level Functions
165165
The optional *f* argument can be used to specify an alternate
166166
:ref:`stack frame <frame-objects>`
167167
to start. The optional *file* argument has the same meaning as for
168-
:func:`print_tb`. If *show_lines* is ``False``, source code lines are
169-
not included in the output.
168+
:func:`print_tb`. If *show_lines* is true, source code lines are
169+
included in the output.
170170

171171
.. versionchanged:: 3.5
172172
Added negative *limit* support.
@@ -201,7 +201,7 @@ Module-Level Functions
201201
Print the list of tuples as returned by :func:`extract_tb` or
202202
:func:`extract_stack` as a formatted stack trace to the given file.
203203
If *file* is ``None``, the output is written to :data:`sys.stderr`.
204-
If *show_lines* is ``False``, source code lines are not included in the output.
204+
If *show_lines* is true, source code lines are included in the output.
205205

206206
.. versionchanged:: next
207207
Added *show_lines* parameter.
@@ -214,8 +214,8 @@ Module-Level Functions
214214
for printing. Each string in the resulting list corresponds to the item with
215215
the same index in the argument list. Each string ends in a newline; the
216216
strings may contain internal newlines as well, for those items whose source
217-
text line is not ``None``. If *show_lines* is ``False``, source code lines
218-
are not included in the output.
217+
text line is not ``None``. If *show_lines* is ``True``, source code lines
218+
are included in the output.
219219

220220
.. versionchanged:: next
221221
Added *show_lines* parameter.
@@ -259,7 +259,7 @@ Module-Level Functions
259259
containing internal newlines. When these lines are concatenated and printed,
260260
exactly the same text is printed as does :func:`print_exception`.
261261

262-
If *show_lines* is false, source code lines are not included in the output.
262+
If *show_lines* is true, source code lines are included in the output.
263263
If *recent_first* is true, the most recent stack trace entries are printed
264264
first, otherwise the oldest entries are printed first. The default is false.
265265

@@ -279,7 +279,7 @@ Module-Level Functions
279279
This is like ``print_exc(limit)`` but returns a string instead of printing to
280280
a file.
281281

282-
If *show_lines* is false, source code lines are not included in the output.
282+
If *show_lines* is true, source code lines are included in the output.
283283
If *recent_first* is true, the most recent stack trace entries are printed
284284
first, otherwise the oldest entries are printed first. The default is false.
285285

@@ -478,7 +478,7 @@ the module-level functions described above.
478478
Print to *file* (default ``sys.stderr``) the exception information returned by
479479
:meth:`format`.
480480

481-
If *show_lines* is false, source code lines from being included in the output.
481+
If *show_lines* is true, source code lines are included in the output.
482482

483483
If *recent_first* is true, the exception is printed first followed by stack
484484
trace by "most recent call first" order.
@@ -501,7 +501,7 @@ the module-level functions described above.
501501
some containing internal newlines. :func:`~traceback.print_exception`
502502
is a wrapper around this method which just prints the lines to a file.
503503

504-
If *show_lines* is false, source code lines from being included in the output.
504+
If *show_lines* is true, source code lines are included in the output.
505505

506506
If *recent_first* is true, the exception is printed first followed by stack
507507
trace by "most recent call first" order.
@@ -585,8 +585,7 @@ the module-level functions described above.
585585
repetitions are shown, followed by a summary line stating the exact
586586
number of further repetitions.
587587

588-
The keyword argument *show_lines*, if ``False``, prevents source code
589-
lines from being included in the output.
588+
If *show_lines* is true, includes source code lines in the output.
590589

591590
.. versionchanged:: 3.6
592591
Long sequences of repeated frames are now abbreviated.
@@ -602,8 +601,8 @@ the module-level functions described above.
602601
printed by :meth:`StackSummary.format`. If it returns ``None``, the
603602
frame is omitted from the output.
604603

605-
The keyword argument *show_lines*, if ``False``, prevents source code
606-
lines from being included in the output.
604+
The keyword argument *show_lines*, if ``True``, includes source code
605+
lines in the output.
607606

608607
.. versionadded:: 3.11
609608

Doc/whatsnew/3.15.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ tarfile
174174
traceback
175175
----------
176176

177-
* Add new ``show_lines`` and ``recent_first`` keyword only arguments to
177+
* Add new *show_lines* and *recent_first* keyword only arguments to
178178
the :mod:`traceback` functions.
179179

180-
The ``show_lines`` argument controls whether source code lines are displayed.
180+
The *show_lines* argument controls whether source code lines are displayed.
181181
It is default to ``True``.
182182

183-
The ``recent_first`` argument controls whether the most recent frames are
183+
The *recent_first* argument controls whether the most recent frames are
184184
displayed first or last in the traceback. It affects whether the exception
185185
is displayed at the top or bottom of the traceback. It is default to ``False``.
186186
(Contributed by Inada Naoki in :gh:`135751`)

0 commit comments

Comments
 (0)