Skip to content

Fix PEP 813 printer regressions after the C migration - #4

Merged
ericvsmith merged 2 commits into
ericvsmith:PEP-813-pprintfrom
warsaw:fix-pep813-printer
Oct 23, 2026
Merged

ericvsmith merged 2 commits into
ericvsmith:PEP-813-pprintfrom
warsaw:fix-pep813-printer

Conversation

@warsaw

@warsaw warsaw commented Oct 23, 2026

Copy link
Copy Markdown

The C migration left the printer referring to document classes removed by the marker-table refactor, so even a basic f'{[1, 2]!p}' raises NameError. Restore marker lookup, layout, rendering, and width measurement through the existing marker table, and remove the superseded literal-rendering code.

Also restore the Python leaf markers' use of __name__ in their representations, preserve an explicit Layout.close when open is omitted, and apply PrettyPrinter's width, indent, and depth validation and numeric coercion to Printer. Add regression tests for delimiter handling and constructor options; the existing marker tests cover the rendering and representation regressions.

Validation: rebuilt the interpreter with make -j4; all 674 tests passed across test__pprint, test_pprint, test_fstring, test_tstring, test_dataclasses, test_string.test_templatelib, test_format, and test_collections. git diff --check passes.

Prepared with OpenAI Codex assistance.

@ericvsmith
ericvsmith merged commit e1429e0 into ericvsmith:PEP-813-pprint Oct 23, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants