[pyupgrade] Fix handling of \N in raw strings (UP032)#22149
[pyupgrade] Fix handling of \N in raw strings (UP032)#22149ntBre merged 6 commits intoastral-sh:mainfrom
pyupgrade] Fix handling of \N in raw strings (UP032)#22149Conversation
|
|
This PR suppresses the fix when a raw string contains |
25968ba to
c338ba8
Compare
c338ba8 to
383d400
Compare
@dscorbett @ntBre does it make sense now? |
ntBre
left a comment
There was a problem hiding this comment.
Thank you! This makes sense to me overall. I just had a suggestion about the FormatString API.
pyupgrade] Fix handling of \N in raw strings (UP032)
|
@ntBre sorry I somehow missed your response, PR stayed silent and some time after I just stopped checking and only now noticed I agree with your comments and than you for pushing those commits! |
…h#22149) **Summary:** Fixes UP032 autofix incorrectly converting raw strings with `\N{...}` to f-strings, which changes semantics and causes runtime errors. Fixes astral-sh#22060 ## Test Plan - Added test case for raw strings with \N{...} - Regular strings with \N{...} still autofix correctly - All 119 pyupgrade tests pass --------- Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
Summary:
Fixes UP032 autofix incorrectly converting raw strings with
\N{...}to f-strings, which changes semantics and causes runtime errors.Fixes #22060
Test Plan