You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove duplicate code by making traceback.print_list() delegate to format_list() #153782
In Lib/traceback.py, the public helpers print_list() and format_list() independently contain the same formatting expression, so their outputs agree only by duplication. We propose routing print_list() through format_list() so that they share a single formatting path, with no change in behavior.
The outputs match only because StackSummary.from_list(extracted_list).format() is duplicated in both. Any future change to how a frame list is formatted has to be applied in both places to prevent the two public helpers from silently diverging.
This eliminates the possibility of drift and mirrors the delegation already used in this module; for example, print_tb() calls print_list() rather than re-deriving extract_tb(...).format().
As explained on the PR this is borderline cosmetic and we do not accept such changes. But the PR includes tests that may be relevant so I am willing to make an exception for the sake of other functions that follow that pattern.
Activity
picnixz commentedon Jul 15, 2026
As explained on the PR this is borderline cosmetic and we do not accept such changes. But the PR includes tests that may be relevant so I am willing to make an exception for the sake of other functions that follow that pattern.