@@ -351,7 +351,7 @@ storing this information by avoiding holding references to
351
351
In addition, they expose more options to configure the output compared to
352
352
the module-level functions described above.
353
353
354
- .. class :: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True , capture_locals=False, compact=False, max_group_width=15, max_group_depth=10)
354
+ .. 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)
355
355
356
356
Capture an exception for later rendering. The meaning of *limit *,
357
357
*lookup_lines * and *capture_locals * are as for the :class: `StackSummary `
@@ -377,6 +377,10 @@ the module-level functions described above.
377
377
.. versionchanged :: 3.11
378
378
Added the *max_group_width * and *max_group_depth * parameters.
379
379
380
+ .. versionchanged :: next
381
+ Changed *lookup_lines * default to ``False `` to avoid overhead when
382
+ formatting exceptions with ``show_lines=False ``.
383
+
380
384
.. attribute :: __cause__
381
385
382
386
A :class: `!TracebackException ` of the original
@@ -459,13 +463,17 @@ the module-level functions described above.
459
463
460
464
For syntax errors - the compiler error message.
461
465
462
- .. classmethod :: from_exception(exc, *, limit=None, lookup_lines=True , capture_locals=False)
466
+ .. classmethod :: from_exception(exc, *, limit=None, lookup_lines=False , capture_locals=False)
463
467
464
468
Capture an exception for later rendering. *limit *, *lookup_lines * and
465
469
*capture_locals * are as for the :class: `StackSummary ` class.
466
470
467
471
Note that when locals are captured, they are also shown in the traceback.
468
472
473
+ .. versionchanged :: next
474
+ Changed *lookup_lines * default to ``False `` to avoid overhead when
475
+ formatting exceptions with ``show_lines=False ``.
476
+
469
477
.. method :: print(*, file=None, chain=True, show_lines=True, recent_first=False)
470
478
471
479
Print to *file * (default ``sys.stderr ``) the exception information returned by
@@ -537,7 +545,7 @@ the module-level functions described above.
537
545
538
546
.. class :: StackSummary
539
547
540
- .. classmethod :: extract(frame_gen, *, limit=None, lookup_lines=True , capture_locals=False)
548
+ .. classmethod :: extract(frame_gen, *, limit=None, lookup_lines=False , capture_locals=False)
541
549
542
550
Construct a :class: `!StackSummary ` object from a frame generator (such as
543
551
is returned by :func: `~traceback.walk_stack ` or
@@ -555,6 +563,10 @@ the module-level functions described above.
555
563
Exceptions raised from :func: `repr ` on a local variable (when
556
564
*capture_locals * is ``True ``) are no longer propagated to the caller.
557
565
566
+ .. versionchanged :: next
567
+ Changed *lookup_lines * default to ``False `` to avoid overhead when
568
+ formatting traceback with ``show_lines=False ``.
569
+
558
570
.. classmethod :: from_list(a_list)
559
571
560
572
Construct a :class: `!StackSummary ` object from a supplied list of
0 commit comments