dflook / python-minifier

Transform Python source code into its most compact representation
MIT License
558 stars 41 forks source link

Inconsistency between stdin and file input #40

Closed clbarnes closed 2 years ago

clbarnes commented 2 years ago

sys.stdin.read() reads a UTF-8 string, but a file is opened in binary mode (and therefore reads bytes). Either bytes should be read from sys.stdin.buffer, or the file should be opened in text mode.

dflook commented 2 years ago

Hi @clbarnes, do you have an example where this causes a problem?

clbarnes commented 2 years ago

No particular examples - does this inconsistency solve any problems itself? The default python source encoding is UTF-8, but other encodings are allowed, so they should probably both return bytes, I guess?

dflook commented 2 years ago

This has been fixed in 2.6.0, stdin is now read as bytes.