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
Regression: impossible to dump multiline strings with leading newline #655
But the situation is not ideal because under escape=False the value of the string does not match the parsing of the original.
More principled solutions that would change the API:
Have the string function take two optional string arguments value and original, one of which must be given. If original is None, it is computed from value as currently with escape=True. If value is None, it is parsed from original. If both are given, one might have a sanity check that the parsing of original agrees with value.
Have two separate String building functions, one taking a parsed string and one taking an unparsed string.
Activity
sattlerc commentedon Oct 14, 2026
#658 is a clean fix that does not change the API.
But the situation is not ideal because under
escape=Falsethe value of the string does not match the parsing of the original.More principled solutions that would change the API:
stringfunction take two optional string argumentsvalueandoriginal, one of which must be given. Iforiginalis None, it is computed fromvalueas currently withescape=True. Ifvalueis None, it is parsed fromoriginal. If both are given, one might have a sanity check that the parsing oforiginalagrees withvalue.Stringbuilding functions, one taking a parsed string and one taking an unparsed string.Fix regression in String.from_raw and improve documentation (#658)