ikamensh / flynt

A tool to automatically convert old string literal formatting to f-strings
MIT License
685 stars 33 forks source link

Fix for issues #55 and #104 #153

Closed akx closed 1 year ago

akx commented 1 year ago

The gist of it: astor has a bug where it unescapes escape characters (boo). ast.unparse (Python 3.9+) doesn't have that bug, but since we're not targeting Python 3.9, we can't use that, and using it conditionally doesn't quite work either since it serializes things differently enough to break quite some tests.

The particular form of escape characters can change (octal escapes turn to hexes, and hex escapes are lower-cased), but they're still escaped and not control characters embedded in source.

This PR includes integration tests for the issues it fixes:

Fixes #55 Fixes #104