zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Try output encodings in the right order please #255

Closed mgedmin closed 6 years ago

mgedmin commented 6 years ago

Set iteration order is not defined in Python. This loop is one where the order matters, otherwise we could be "upgrading" to UTF-8 without any reason, leading to bugs like #254.

I have not tested that this fix works.

I don't currently have the time to write a unit test that would expose the bug.

mgedmin commented 6 years ago

Also, the insidious thing about this bug is that write_text_file() first reports

            logger.debug("Writing to %s with its original encoding %s",
                         filename, encoding)

and then it silently upgrades that encoding to something else, without informing the user. You may want to fix that too!

reinout commented 6 years ago

Ouch! Good catch. That set() is a small optimization that actually breaks the functionality!

Commit https://github.com/zestsoftware/zest.releaser/commit/95e3bd3daa1617e85aee56ba93c961be8784e7da fixes the logging.

reinout commented 6 years ago

Released in 6.13.2

mgedmin commented 6 years ago

Thank you!

(:fireworks: The fix works! :fireworks:)