bpo-28002: Roundtrip f-strings with ast.unparse better by hauntsaninja · Pull Request #19612 · python/cpython (original) (raw)
Thanks, updated to include your two comments!
I think including \n
into the exception list is reasonable, and would fix the common f"{x}\n"
case. There would be a regression in being able to unparse some of the test cases I added in test_fstrings_complicated
, but those are less common, so it would still be the pragmatic thing to do.
Let me see if I can come up with a fix over the weekend, otherwise we can go ahead and make the should_use_repr
change.