Repository navigation
Fix regression in String.from_raw and improve documentation - #658
Conversation
Wkhanex
left a comment
There was a problem hiding this comment.
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.
|
Explain why not #656 |
In contrast to #656, this PR:
Note that the situation is still not ideal, see #655 (comment). A proper solution would require an API change, but that's beyond the scope of this bug fix. |
|
@dimbleby I'm tired of this—just one week, 20 new PRs. How can this be mitigated? Any good suggestion? |
|
You have my sympathy. I see a similar influx of mixed quality AI pull requests in poetry: it is a blessing and a curse. (Ack that sattlerc explicitly says this PR is human-written, I am talking about the larger picture rather than this one specifically). The bots are pretty good at following instructions, so it is likely worth putting some instructions in the repository somewhere - AGENTS.md or whatever - saying what sort of AI contributions are acceptable to you. If you can identify what it is you don't like about what they're doing today - write that down and tell them not to do it. Eg text like "before contributing a pull request you must check for open pull requests already fixing the same thing" would likely discourage most of the duplicates. You could even write that you didn't want any AI contributions at all, though I think that would be a shame - there are some genuine bugs and fixes being contributed. But lots of projects are doing that, you would not be alone. I expect your time is limited, but in principle another answer would be to review and merge more. Once a bug is fixed - that should stop the bots from sending fixes for it. |
This PR streamlines the control flow of
String.from_raw, fixing #655, and improves the documentation ofstring(..., escape=False).