Skip to content

Commit 2612590

Browse files
committed
s/show_lines/show_source_lines/
1 parent 63113e7 commit 2612590

File tree

5 files changed

+164
-151
lines changed

5 files changed

+164
-151
lines changed

Doc/library/traceback.rst

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The module's API can be divided into two parts:
5252
Module-Level Functions
5353
----------------------
5454

55-
.. function:: print_tb(tb, limit=None, file=None, *, show_lines=True, recent_first=False)
55+
.. function:: print_tb(tb, limit=None, file=None, *, show_source_lines=True, recent_first=False)
5656

5757
Print up to *limit* stack trace entries from
5858
:ref:`traceback object <traceback-objects>` *tb* (starting
@@ -63,7 +63,8 @@ Module-Level Functions
6363
:term:`file <file object>` or :term:`file-like object` to
6464
receive the output.
6565

66-
If *show_lines* is true (the default), source code lines will be included in the output.
66+
If *show_source_lines* is true (the default), source code lines
67+
will be included in the output.
6768

6869
If *recent_first* is true, the most recent stack trace entries are printed
6970
first, otherwise the oldest entries are printed first. The default is false.
@@ -85,11 +86,12 @@ Module-Level Functions
8586
Added negative *limit* support.
8687

8788
.. versionchanged:: next
88-
Added the *show_lines* and *recent_first* parameters.
89+
Added the *show_source_lines* and *recent_first* parameters.
8990

9091

9192
.. function:: print_exception(exc, /[, value, tb], limit=None, \
92-
file=None, chain=True, *, show_lines=True, recent_first=False)
93+
file=None, chain=True, *, \
94+
show_source_lines=True, recent_first=False)
9395
9496
Print exception information and stack trace entries from
9597
:ref:`traceback object <traceback-objects>`
@@ -118,7 +120,7 @@ Module-Level Functions
118120
printed as well, like the interpreter itself does when printing an unhandled
119121
exception.
120122

121-
If *show_lines* is true, source code lines are included in the output.
123+
If *show_source_lines* is true, source code lines are included in the output.
122124

123125
If *recent_first* is true, the most recent stack trace entries are printed
124126
first, otherwise the oldest entries are printed first. The default is false.
@@ -131,45 +133,45 @@ Module-Level Functions
131133
positional-only.
132134

133135
.. versionchanged:: next
134-
Added the *show_lines* and *recent_first* parameters.
136+
Added the *show_source_lines* and *recent_first* parameters.
135137

136138

137-
.. function:: print_exc(limit=None, file=None, chain=True, *, show_lines=True, recent_first=False)
139+
.. function:: print_exc(limit=None, file=None, chain=True, *, show_source_lines=True, recent_first=False)
138140

139141
This is a shorthand for ``print_exception(sys.exception(), limit=limit, file=file,
140-
chain=chain, show_lines=show_lines, recent_first=recent_first)``.
142+
chain=chain, show_source_lines=show_source_lines, recent_first=recent_first)``.
141143

142144
.. versionchanged:: next
143-
Added the *show_lines* and *recent_first* parameters.
145+
Added the *show_source_lines* and *recent_first* parameters.
144146

145147

146-
.. function:: print_last(limit=None, file=None, chain=True, *, show_lines=True, recent_first=False)
148+
.. function:: print_last(limit=None, file=None, chain=True, *, show_source_lines=True, recent_first=False)
147149

148150
This is a shorthand for ``print_exception(sys.last_exc, limit=limit, file=file,
149-
chain=chain, show_lines=show_lines, recent_first=recent_first)``.
151+
chain=chain, show_source_lines=show_source_lines, recent_first=recent_first)``.
150152
In general it will work only after an exception has reached an interactive
151153
prompt (see :data:`sys.last_exc`).
152154

153155
.. versionchanged:: next
154-
Added the *show_lines* and *recent_first* parameters.
156+
Added the *show_source_lines* and *recent_first* parameters.
155157

156158

157-
.. function:: print_stack(f=None, limit=None, file=None, *, show_lines=True, recent_first=False)
159+
.. function:: print_stack(f=None, limit=None, file=None, *, show_source_lines=True, recent_first=False)
158160

159161
Print up to *limit* stack trace entries (starting from the invocation
160162
point) if *limit* is positive. Otherwise, print the last ``abs(limit)``
161163
entries. If *limit* is omitted or ``None``, all entries are printed.
162164
The optional *f* argument can be used to specify an alternate
163165
:ref:`stack frame <frame-objects>`
164166
to start. The optional *file* argument has the same meaning as for
165-
:func:`print_tb`. If *show_lines* is true, source code lines are
166-
included in the output.
167+
:func:`print_tb`.
168+
If *show_source_lines* is true, source code lines are included in the output.
167169

168170
.. versionchanged:: 3.5
169171
Added negative *limit* support.
170172

171173
.. versionchanged:: next
172-
Added the *show_lines* and *recent_first* parameters.
174+
Added the *show_source_lines* and *recent_first* parameters.
173175

174176

175177
.. function:: extract_tb(tb, limit=None)
@@ -193,29 +195,29 @@ Module-Level Functions
193195
arguments have the same meaning as for :func:`print_stack`.
194196

195197

196-
.. function:: print_list(extracted_list, file=None, *, show_lines=True)
198+
.. function:: print_list(extracted_list, file=None, *, show_source_lines=True)
197199

198200
Print the list of tuples as returned by :func:`extract_tb` or
199201
:func:`extract_stack` as a formatted stack trace to the given file.
200202
If *file* is ``None``, the output is written to :data:`sys.stderr`.
201-
If *show_lines* is true, source code lines are included in the output.
203+
If *show_source_lines* is true, source code lines are included in the output.
202204

203205
.. versionchanged:: next
204-
Added the *show_lines* parameter.
206+
Added the *show_source_lines* parameter.
205207

206208

207-
.. function:: format_list(extracted_list, *, show_lines=True)
209+
.. function:: format_list(extracted_list, *, show_source_lines=True)
208210

209211
Given a list of tuples or :class:`FrameSummary` objects as returned by
210212
:func:`extract_tb` or :func:`extract_stack`, return a list of strings ready
211213
for printing. Each string in the resulting list corresponds to the item with
212214
the same index in the argument list. Each string ends in a newline; the
213215
strings may contain internal newlines as well, for those items whose source
214-
text line is not ``None``. If *show_lines* is ``True``, source code lines
215-
are included in the output.
216+
text line is not ``None``.
217+
If *show_source_lines* is true, source code lines are included in the output.
216218

217219
.. versionchanged:: next
218-
Added the *show_lines* parameter.
220+
Added the *show_source_lines* parameter.
219221

220222

221223
.. function:: format_exception_only(exc, /[, value], *, show_group=False)
@@ -248,15 +250,16 @@ Module-Level Functions
248250
*show_group* parameter was added.
249251

250252

251-
.. function:: format_exception(exc, /[, value, tb], limit=None, chain=True, *, show_lines=True, recent_first=False, show_group=False)
253+
.. function:: format_exception(exc, /[, value, tb], limit=None, chain=True, *, \
254+
show_source_lines=True, recent_first=False)
252255

253256
Format a stack trace and the exception information. The arguments have the
254257
same meaning as the corresponding arguments to :func:`print_exception`. The
255258
return value is a list of strings, each ending in a newline and some
256259
containing internal newlines. When these lines are concatenated and printed,
257260
exactly the same text is printed as does :func:`print_exception`.
258261

259-
If *show_lines* is true, source code lines are included in the output.
262+
If *show_source_lines* is true, source code lines are included in the output.
260263
If *recent_first* is true, the most recent stack trace entries are printed
261264
first, otherwise the oldest entries are printed first. The default is false.
262265

@@ -268,40 +271,40 @@ Module-Level Functions
268271
:func:`print_exception`.
269272

270273
.. versionchanged:: next
271-
Added the *show_lines* and *recent_first* parameters.
274+
Added the *show_source_lines* and *recent_first* parameters.
272275

273276

274-
.. function:: format_exc(limit=None, chain=True, *, show_lines=True, recent_first=False)
277+
.. function:: format_exc(limit=None, chain=True, *, show_source_lines=True, recent_first=False)
275278

276279
This is like ``print_exc(limit)`` but returns a string instead of printing to
277280
a file.
278281

279-
If *show_lines* is true, source code lines are included in the output.
282+
If *show_source_lines* is true, source code lines are included in the output.
280283
If *recent_first* is true, the most recent stack trace entries are printed
281284
first, otherwise the oldest entries are printed first. The default is false.
282285

283286
.. versionchanged:: next
284-
Added the *show_lines* and *recent_first* parameters.
287+
Added the *show_source_lines* and *recent_first* parameters.
285288

286289

287-
.. function:: format_tb(tb, limit=None, *, show_lines=True, recent_first=False)
290+
.. function:: format_tb(tb, limit=None, *, show_source_lines=True, recent_first=False)
288291

289-
A shorthand for ``format_list(extract_tb(tb, limit), show_lines=show_lines)``.
292+
A shorthand for ``format_list(extract_tb(tb, limit), show_source_lines=show_source_lines)``.
290293

291294
If *recent_first* is true, ``reversed(extract_tb(tb, limit))`` is used.
292295

293296
.. versionchanged:: next
294-
Added the *show_lines* and *recent_first* parameters.
297+
Added the *show_source_lines* and *recent_first* parameters.
295298

296299

297-
.. function:: format_stack(f=None, limit=None, *, show_lines=True, recent_first=False)
300+
.. function:: format_stack(f=None, limit=None, *, show_source_lines=True, recent_first=False)
298301

299-
A shorthand for ``format_list(extract_stack(f, limit), show_lines=show_lines)``.
302+
A shorthand for ``format_list(extract_stack(f, limit), show_source_lines=show_source_lines)``.
300303

301304
If *recent_first* is true, ``reversed(extract_stack(f, limit))`` is used.
302305

303306
.. versionchanged:: next
304-
Added the *show_lines* and *recent_first* parameters.
307+
Added the *show_source_lines* and *recent_first* parameters.
305308

306309
.. function:: clear_frames(tb)
307310

@@ -347,7 +350,8 @@ storing this information by avoiding holding references to
347350
In addition, they expose more options to configure the output compared to
348351
the module-level functions described above.
349352

350-
.. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=False, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10)
353+
.. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=False, \
354+
capture_locals=False, compact=False, max_group_width=15, max_group_depth=10)
351355

352356
Capture an exception for later rendering. The meaning of *limit*,
353357
*lookup_lines* and *capture_locals* are as for the :class:`StackSummary`
@@ -375,7 +379,7 @@ the module-level functions described above.
375379

376380
.. versionchanged:: next
377381
Changed *lookup_lines* default to ``False`` to avoid overhead when
378-
formatting exceptions with ``show_lines=False``.
382+
formatting exceptions with ``show_source_lines=False``.
379383

380384
.. attribute:: __cause__
381385

@@ -468,14 +472,14 @@ the module-level functions described above.
468472

469473
.. versionchanged:: next
470474
Changed *lookup_lines* default to ``False`` to avoid overhead when
471-
formatting exceptions with ``show_lines=False``.
475+
formatting exceptions with ``show_source_lines=False``.
472476

473-
.. method:: print(*, file=None, chain=True, show_lines=True, recent_first=False)
477+
.. method:: print(*, file=None, chain=True, show_source_lines=True, recent_first=False)
474478

475479
Print to *file* (default ``sys.stderr``) the exception information returned by
476480
:meth:`format`.
477481

478-
If *show_lines* is true, source code lines are included in the output.
482+
If *show_source_lines* is true, source code lines are included in the output.
479483

480484
If *recent_first* is true, the exception is printed first followed by stack
481485
trace by "most recent call first" order.
@@ -485,9 +489,9 @@ the module-level functions described above.
485489
.. versionadded:: 3.11
486490

487491
.. versionchanged:: next
488-
Added the *show_lines* and *recent_first* parameters.
492+
Added the *show_source_lines* and *recent_first* parameters.
489493

490-
.. method:: format(*, chain=True, show_lines=True, recent_first=False)
494+
.. method:: format(*, chain=True, show_source_lines=True, recent_first=False)
491495

492496
Format the exception.
493497

@@ -498,17 +502,17 @@ the module-level functions described above.
498502
some containing internal newlines. :func:`~traceback.print_exception`
499503
is a wrapper around this method which just prints the lines to a file.
500504

501-
If *show_lines* is true, source code lines are included in the output.
505+
If *show_source_lines* is true, source code lines are included in the output.
502506

503507
If *recent_first* is true, the exception is printed first followed by stack
504508
trace by "most recent call first" order.
505509
Otherwise, the stack trace is printed first by "most recent call last" order
506510
followed by the exception.
507511

508512
.. versionchanged:: next
509-
Added the *show_lines* and *recent_first* parameters.
513+
Added the *show_source_lines* and *recent_first* parameters.
510514

511-
.. method:: format_exception_only(*, show_group=False)
515+
.. method:: format_exception_only(*, show_group=False)
512516

513517
Format the exception part of the traceback.
514518

@@ -561,7 +565,7 @@ the module-level functions described above.
561565

562566
.. versionchanged:: next
563567
Changed *lookup_lines* default to ``False`` to avoid overhead when
564-
formatting traceback with ``show_lines=False``.
568+
formatting traceback with ``show_source_lines=False``.
565569

566570
.. classmethod:: from_list(a_list)
567571

@@ -570,7 +574,7 @@ the module-level functions described above.
570574
should be a 4-tuple with *filename*, *lineno*, *name*, *line* as the
571575
elements.
572576

573-
.. method:: format(*, show_lines=True)
577+
.. method:: format(*, show_source_lines=True)
574578

575579
Returns a list of strings ready for printing. Each string in the
576580
resulting list corresponds to a single :ref:`frame <frame-objects>` from
@@ -582,29 +586,28 @@ the module-level functions described above.
582586
repetitions are shown, followed by a summary line stating the exact
583587
number of further repetitions.
584588

585-
If *show_lines* is true, includes source code lines in the output.
589+
If *show_source_lines* is true, includes source code lines in the output.
586590

587591
.. versionchanged:: 3.6
588592
Long sequences of repeated frames are now abbreviated.
589593

590594
.. versionchanged:: next
591-
Added the *show_lines* parameter.
595+
Added the *show_source_lines* parameter.
592596

593-
.. method:: format_frame_summary(frame_summary, *, show_lines=True, **kwargs)
597+
.. method:: format_frame_summary(frame_summary, *, show_source_lines=True, **kwargs)
594598

595599
Returns a string for printing one of the :ref:`frames <frame-objects>`
596600
involved in the stack.
597601
This method is called for each :class:`FrameSummary` object to be
598602
printed by :meth:`StackSummary.format`. If it returns ``None``, the
599603
frame is omitted from the output.
600604

601-
The keyword argument *show_lines*, if ``True``, includes source code
602-
lines in the output.
605+
If *show_source_lines* is true, includes source code lines in the output.
603606

604607
.. versionadded:: 3.11
605608

606609
.. versionchanged:: next
607-
Added the *show_lines* parameter.
610+
Added the *show_source_lines* parameter.
608611

609612

610613
:class:`!FrameSummary` Objects

Doc/whatsnew/3.15.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@ tarfile
305305
traceback
306306
----------
307307

308-
* Add new *show_lines* and *recent_first* keyword only arguments to
308+
* Add new *show_source_lines* and *recent_first* keyword only arguments to
309309
the :mod:`traceback` functions.
310310

311-
The *show_lines* argument controls whether source code lines are displayed.
311+
The *show_source_lines* argument controls whether source code lines are displayed.
312312
It is default to ``True``.
313313

314314
The *recent_first* argument controls whether the most recent frames are

0 commit comments

Comments
 (0)