镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix regression in String.from_raw and improve documentation - #658

Open
sattlerc wants to merge 2 commits into
python-poetry:masterfrom
sattlerc:issue655
Open

sattlerc wants to merge 2 commits into
python-poetry:masterfrom
sattlerc:issue655

Conversation

@sattlerc

Copy link
Copy Markdown

This PR streamlines the control flow of String.from_raw, fixing #655, and improves the documentation of string(..., escape=False).

@Wkhanex Wkhanex left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted validation at 386786c7a48c on Python 3.12.14: I checked basic/literal and single/multiline strings with backslashes, a tab, Unicode text, and ordinary text. With escaping enabled, all 16 combinations round-tripped through tomllib with their input value intact. For multiline strings beginning with one or two LFs, I separately verified that escape=False emits the supplied body verbatim, while the default mode adds the trim-protection newline. The 79 string-focused API/item tests passed.

That separation is the behavior I would preserve in regression coverage: verbatim mode may intentionally give a parsed value different from the raw body because TOML trims an opening newline. It should not silently gain the extra newline needed by the default value-preserving mode.

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