Closed JocelynDelalande closed 5 years ago
zest.releaser does its best to detect encodings in a reliable way. There are several ways in which it does this. Adding the BOM at the start takes you into one part of the code (which works), without it you end up in another part (which apparently fails).
I took your "faulty" setup.py (thanks for the link) and I could reproduce the issue perfectly.
The failing part looks for a -*- encoding:
string just like you have and only concatenates the characters behind that encoding hint until it finds a space or a '\n'. This is where it weirdly fails. I have a tiny example (python 3.7):
>>> example = b'just a bytes string'
>>> type(example)
<class 'bytes'>
>>> example[0]
106
>>> type(example[0])
<class 'int'>
What? Grabbing an item from bytes
gives an int? Concatenating with '+=' won't work then!
I expected it to give me a one-character bytes string. I just checked: it works on python 2.7. So there's some 2/3 weirdness going on.
On python 3, I get back "bytes" when I use a range (length 1...):
>>> example = b'just a string'
>>> example[0] # We don't want an int
106
>>> example[0:1] # This way we get bytes
b'j'
I expected it to give me a one-character bytes string. I just checked: it works on python 2.7. So there's some 2/3 weirdness going on.
Weird. That was my first guess, and I had tested, for me it did not work better on py2.
Thanks for your quick (and scenarized ;-)) answer and diagnosis :-).
Fixed by Reinout in 6.15.3.
:heart: :-) Thanks @mauritsvanrees @reinout
Crashing on
fullrelease
command.I quick-fixed it for my project adding the BOM header, but I suspect it to be a zest.releaser bug.
Faulty setup.py
Commit "Fixing" setup.py.
The error was the following :
Let me know if I can help in any way :-)