@@ -351,7 +351,7 @@ storing this information by avoiding holding references to
351351In addition, they expose more options to configure the output compared to
352352the module-level functions described above.
353353
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)
355355
356356 Capture an exception for later rendering. The meaning of *limit *,
357357 *lookup_lines * and *capture_locals * are as for the :class: `StackSummary `
@@ -377,6 +377,10 @@ the module-level functions described above.
377377 .. versionchanged :: 3.11
378378 Added the *max_group_width * and *max_group_depth * parameters.
379379
380+ .. versionchanged :: next
381+ Changed *lookup_lines * default to ``False `` to avoid overhead when
382+ formatting exceptions with ``show_lines=False ``.
383+
380384 .. attribute :: __cause__
381385
382386 A :class: `!TracebackException ` of the original
@@ -459,13 +463,17 @@ the module-level functions described above.
459463
460464 For syntax errors - the compiler error message.
461465
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)
463467
464468 Capture an exception for later rendering. *limit *, *lookup_lines * and
465469 *capture_locals * are as for the :class: `StackSummary ` class.
466470
467471 Note that when locals are captured, they are also shown in the traceback.
468472
473+ .. versionchanged :: next
474+ Changed *lookup_lines * default to ``False `` to avoid overhead when
475+ formatting exceptions with ``show_lines=False ``.
476+
469477 .. method :: print(*, file=None, chain=True, show_lines=True, recent_first=False)
470478
471479 Print to *file * (default ``sys.stderr ``) the exception information returned by
@@ -537,7 +545,7 @@ the module-level functions described above.
537545
538546.. class :: StackSummary
539547
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)
541549
542550 Construct a :class: `!StackSummary ` object from a frame generator (such as
543551 is returned by :func: `~traceback.walk_stack ` or
@@ -555,6 +563,10 @@ the module-level functions described above.
555563 Exceptions raised from :func: `repr ` on a local variable (when
556564 *capture_locals * is ``True ``) are no longer propagated to the caller.
557565
566+ .. versionchanged :: next
567+ Changed *lookup_lines * default to ``False `` to avoid overhead when
568+ formatting traceback with ``show_lines=False ``.
569+
558570 .. classmethod :: from_list(a_list)
559571
560572 Construct a :class: `!StackSummary ` object from a supplied list of
0 commit comments