@@ -52,7 +52,7 @@ The module's API can be divided into two parts:
52
52
Module-Level Functions
53
53
----------------------
54
54
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)
56
56
57
57
Print up to *limit * stack trace entries from
58
58
:ref: `traceback object <traceback-objects >` *tb * (starting
@@ -63,7 +63,7 @@ Module-Level Functions
63
63
:term: `file <file object> ` or :term: `file-like object ` to
64
64
receive the output.
65
65
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 will be included in the output.
67
67
68
68
If *recent_first * is true, the most recent stack trace entries are printed
69
69
first, otherwise the oldest entries are printed first. The default is false.
@@ -85,11 +85,11 @@ Module-Level Functions
85
85
Added negative *limit * support.
86
86
87
87
.. versionchanged :: next
88
- Added the *show_lines * and *recent_first * parameters.
88
+ Added the *show_source_lines * and *recent_first * parameters.
89
89
90
90
91
91
.. function :: print_exception(exc, /[, value, tb], limit=None, \
92
- file=None, chain=True, *, show_lines =True, recent_first=False)
92
+ file=None, chain=True, *, show_source_lines =True, recent_first=False)
93
93
94
94
Print exception information and stack trace entries from
95
95
:ref: `traceback object <traceback-objects >`
@@ -118,7 +118,7 @@ Module-Level Functions
118
118
printed as well, like the interpreter itself does when printing an unhandled
119
119
exception.
120
120
121
- If *show_lines * is true, source code lines are included in the output.
121
+ If *show_source_lines * is true, source code lines are included in the output.
122
122
123
123
If *recent_first * is true, the most recent stack trace entries are printed
124
124
first, otherwise the oldest entries are printed first. The default is false.
@@ -131,45 +131,45 @@ Module-Level Functions
131
131
positional-only.
132
132
133
133
.. versionchanged :: next
134
- Added the *show_lines * and *recent_first * parameters.
134
+ Added the *show_source_lines * and *recent_first * parameters.
135
135
136
136
137
- .. function :: print_exc(limit=None, file=None, chain=True, *, show_lines =True, recent_first=False)
137
+ .. function :: print_exc(limit=None, file=None, chain=True, *, show_source_lines =True, recent_first=False)
138
138
139
139
This is a shorthand for ``print_exception(sys.exception(), limit=limit, file=file,
140
- chain=chain, show_lines=show_lines , recent_first=recent_first) ``.
140
+ chain=chain, show_source_lines=show_source_lines , recent_first=recent_first) ``.
141
141
142
142
.. versionchanged :: next
143
- Added the *show_lines * and *recent_first * parameters.
143
+ Added the *show_source_lines * and *recent_first * parameters.
144
144
145
145
146
- .. function :: print_last(limit=None, file=None, chain=True, *, show_lines =True, recent_first=False)
146
+ .. function :: print_last(limit=None, file=None, chain=True, *, show_source_lines =True, recent_first=False)
147
147
148
148
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) ``.
149
+ chain=chain, show_source_lines=show_source_lines , recent_first=recent_first) ``.
150
150
In general it will work only after an exception has reached an interactive
151
151
prompt (see :data: `sys.last_exc `).
152
152
153
153
.. versionchanged :: next
154
- Added the *show_lines * and *recent_first * parameters.
154
+ Added the *show_source_lines * and *recent_first * parameters.
155
155
156
156
157
- .. function :: print_stack(f=None, limit=None, file=None, *, show_lines =True, recent_first=False)
157
+ .. function :: print_stack(f=None, limit=None, file=None, *, show_source_lines =True, recent_first=False)
158
158
159
159
Print up to *limit * stack trace entries (starting from the invocation
160
160
point) if *limit * is positive. Otherwise, print the last ``abs(limit) ``
161
161
entries. If *limit * is omitted or ``None ``, all entries are printed.
162
162
The optional *f * argument can be used to specify an alternate
163
163
:ref: `stack frame <frame-objects >`
164
164
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
165
+ :func: `print_tb `. If *show_source_lines * is true, source code lines are
166
166
included in the output.
167
167
168
168
.. versionchanged :: 3.5
169
169
Added negative *limit * support.
170
170
171
171
.. versionchanged :: next
172
- Added the *show_lines * and *recent_first * parameters.
172
+ Added the *show_source_lines * and *recent_first * parameters.
173
173
174
174
175
175
.. function :: extract_tb(tb, limit=None)
@@ -193,29 +193,29 @@ Module-Level Functions
193
193
arguments have the same meaning as for :func: `print_stack `.
194
194
195
195
196
- .. function :: print_list(extracted_list, file=None, *, show_lines =True)
196
+ .. function :: print_list(extracted_list, file=None, *, show_source_lines =True)
197
197
198
198
Print the list of tuples as returned by :func: `extract_tb ` or
199
199
:func: `extract_stack ` as a formatted stack trace to the given file.
200
200
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.
201
+ If *show_source_lines * is true, source code lines are included in the output.
202
202
203
203
.. versionchanged :: next
204
- Added the *show_lines * parameter.
204
+ Added the *show_source_lines * parameter.
205
205
206
206
207
- .. function :: format_list(extracted_list, *, show_lines =True)
207
+ .. function :: format_list(extracted_list, *, show_source_lines =True)
208
208
209
209
Given a list of tuples or :class: `FrameSummary ` objects as returned by
210
210
:func: `extract_tb ` or :func: `extract_stack `, return a list of strings ready
211
211
for printing. Each string in the resulting list corresponds to the item with
212
212
the same index in the argument list. Each string ends in a newline; the
213
213
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
214
+ text line is not ``None ``. If *show_source_lines * is ``True ``, source code lines
215
215
are included in the output.
216
216
217
217
.. versionchanged :: next
218
- Added the *show_lines * parameter.
218
+ Added the *show_source_lines * parameter.
219
219
220
220
221
221
.. function :: format_exception_only(exc, /[, value], *, show_group=False)
@@ -248,15 +248,15 @@ Module-Level Functions
248
248
*show_group * parameter was added.
249
249
250
250
251
- .. function :: format_exception(exc, /[, value, tb], limit=None, chain=True, *, show_lines =True, recent_first=False, show_group=False)
251
+ .. function :: format_exception(exc, /[, value, tb], limit=None, chain=True, *, show_source_lines =True, recent_first=False, show_group=False)
252
252
253
253
Format a stack trace and the exception information. The arguments have the
254
254
same meaning as the corresponding arguments to :func: `print_exception `. The
255
255
return value is a list of strings, each ending in a newline and some
256
256
containing internal newlines. When these lines are concatenated and printed,
257
257
exactly the same text is printed as does :func: `print_exception `.
258
258
259
- If *show_lines * is true, source code lines are included in the output.
259
+ If *show_source_lines * is true, source code lines are included in the output.
260
260
If *recent_first * is true, the most recent stack trace entries are printed
261
261
first, otherwise the oldest entries are printed first. The default is false.
262
262
@@ -268,40 +268,40 @@ Module-Level Functions
268
268
:func: `print_exception `.
269
269
270
270
.. versionchanged :: next
271
- Added the *show_lines * and *recent_first * parameters.
271
+ Added the *show_source_lines * and *recent_first * parameters.
272
272
273
273
274
- .. function :: format_exc(limit=None, chain=True, *, show_lines =True, recent_first=False)
274
+ .. function :: format_exc(limit=None, chain=True, *, show_source_lines =True, recent_first=False)
275
275
276
276
This is like ``print_exc(limit) `` but returns a string instead of printing to
277
277
a file.
278
278
279
- If *show_lines * is true, source code lines are included in the output.
279
+ If *show_source_lines * is true, source code lines are included in the output.
280
280
If *recent_first * is true, the most recent stack trace entries are printed
281
281
first, otherwise the oldest entries are printed first. The default is false.
282
282
283
283
.. versionchanged :: next
284
- Added the *show_lines * and *recent_first * parameters.
284
+ Added the *show_source_lines * and *recent_first * parameters.
285
285
286
286
287
- .. function :: format_tb(tb, limit=None, *, show_lines =True, recent_first=False)
287
+ .. function :: format_tb(tb, limit=None, *, show_source_lines =True, recent_first=False)
288
288
289
- A shorthand for ``format_list(extract_tb(tb, limit), show_lines=show_lines ) ``.
289
+ A shorthand for ``format_list(extract_tb(tb, limit), show_source_lines=show_source_lines ) ``.
290
290
291
291
If *recent_first * is true, ``reversed(extract_tb(tb, limit)) `` is used.
292
292
293
293
.. versionchanged :: next
294
- Added the *show_lines * and *recent_first * parameters.
294
+ Added the *show_source_lines * and *recent_first * parameters.
295
295
296
296
297
- .. function :: format_stack(f=None, limit=None, *, show_lines =True, recent_first=False)
297
+ .. function :: format_stack(f=None, limit=None, *, show_source_lines =True, recent_first=False)
298
298
299
- A shorthand for ``format_list(extract_stack(f, limit), show_lines=show_lines ) ``.
299
+ A shorthand for ``format_list(extract_stack(f, limit), show_source_lines=show_source_lines ) ``.
300
300
301
301
If *recent_first * is true, ``reversed(extract_stack(f, limit)) `` is used.
302
302
303
303
.. versionchanged :: next
304
- Added the *show_lines * and *recent_first * parameters.
304
+ Added the *show_source_lines * and *recent_first * parameters.
305
305
306
306
.. function :: clear_frames(tb)
307
307
@@ -375,7 +375,7 @@ the module-level functions described above.
375
375
376
376
.. versionchanged :: next
377
377
Changed *lookup_lines * default to ``False `` to avoid overhead when
378
- formatting exceptions with ``show_lines =False ``.
378
+ formatting exceptions with ``show_source_lines =False ``.
379
379
380
380
.. attribute :: __cause__
381
381
@@ -468,14 +468,14 @@ the module-level functions described above.
468
468
469
469
.. versionchanged :: next
470
470
Changed *lookup_lines * default to ``False `` to avoid overhead when
471
- formatting exceptions with ``show_lines =False ``.
471
+ formatting exceptions with ``show_source_lines =False ``.
472
472
473
- .. method :: print(*, file=None, chain=True, show_lines =True, recent_first=False)
473
+ .. method :: print(*, file=None, chain=True, show_source_lines =True, recent_first=False)
474
474
475
475
Print to *file * (default ``sys.stderr ``) the exception information returned by
476
476
:meth: `format `.
477
477
478
- If *show_lines * is true, source code lines are included in the output.
478
+ If *show_source_lines * is true, source code lines are included in the output.
479
479
480
480
If *recent_first * is true, the exception is printed first followed by stack
481
481
trace by "most recent call first" order.
@@ -485,9 +485,9 @@ the module-level functions described above.
485
485
.. versionadded :: 3.11
486
486
487
487
.. versionchanged :: next
488
- Added the *show_lines * and *recent_first * parameters.
488
+ Added the *show_source_lines * and *recent_first * parameters.
489
489
490
- .. method :: format(*, chain=True, show_lines =True, recent_first=False)
490
+ .. method :: format(*, chain=True, show_source_lines =True, recent_first=False)
491
491
492
492
Format the exception.
493
493
@@ -498,15 +498,15 @@ the module-level functions described above.
498
498
some containing internal newlines. :func: `~traceback.print_exception `
499
499
is a wrapper around this method which just prints the lines to a file.
500
500
501
- If *show_lines * is true, source code lines are included in the output.
501
+ If *show_source_lines * is true, source code lines are included in the output.
502
502
503
503
If *recent_first * is true, the exception is printed first followed by stack
504
504
trace by "most recent call first" order.
505
505
Otherwise, the stack trace is printed first by "most recent call last" order
506
506
followed by the exception.
507
507
508
508
.. versionchanged :: next
509
- Added the *show_lines * and *recent_first * parameters.
509
+ Added the *show_source_lines * and *recent_first * parameters.
510
510
511
511
.. method :: format_exception_only(*, show_group=False)
512
512
@@ -561,7 +561,7 @@ the module-level functions described above.
561
561
562
562
.. versionchanged :: next
563
563
Changed *lookup_lines * default to ``False `` to avoid overhead when
564
- formatting traceback with ``show_lines =False ``.
564
+ formatting traceback with ``show_source_lines =False ``.
565
565
566
566
.. classmethod :: from_list(a_list)
567
567
@@ -570,7 +570,7 @@ the module-level functions described above.
570
570
should be a 4-tuple with *filename *, *lineno *, *name *, *line * as the
571
571
elements.
572
572
573
- .. method :: format(*, show_lines =True)
573
+ .. method :: format(*, show_source_lines =True)
574
574
575
575
Returns a list of strings ready for printing. Each string in the
576
576
resulting list corresponds to a single :ref: `frame <frame-objects >` from
@@ -582,29 +582,29 @@ the module-level functions described above.
582
582
repetitions are shown, followed by a summary line stating the exact
583
583
number of further repetitions.
584
584
585
- If *show_lines * is true, includes source code lines in the output.
585
+ If *show_source_lines * is true, includes source code lines in the output.
586
586
587
587
.. versionchanged :: 3.6
588
588
Long sequences of repeated frames are now abbreviated.
589
589
590
590
.. versionchanged :: next
591
- Added the *show_lines * parameter.
591
+ Added the *show_source_lines * parameter.
592
592
593
- .. method :: format_frame_summary(frame_summary, *, show_lines =True, **kwargs)
593
+ .. method :: format_frame_summary(frame_summary, *, show_source_lines =True, **kwargs)
594
594
595
595
Returns a string for printing one of the :ref: `frames <frame-objects >`
596
596
involved in the stack.
597
597
This method is called for each :class: `FrameSummary ` object to be
598
598
printed by :meth: `StackSummary.format `. If it returns ``None ``, the
599
599
frame is omitted from the output.
600
600
601
- The keyword argument *show_lines *, if ``True ``, includes source code
601
+ The keyword argument *show_source_lines *, if ``True ``, includes source code
602
602
lines in the output.
603
603
604
604
.. versionadded :: 3.11
605
605
606
606
.. versionchanged :: next
607
- Added the *show_lines * parameter.
607
+ Added the *show_source_lines * parameter.
608
608
609
609
610
610
:class: `!FrameSummary ` Objects
0 commit comments