Python 3.4 (3.3 is also afflicted:
>>> import struct
>>> struct.Struct(3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Struct() argument 1 must be a bytes object, not int
>>> struct.Struct('b')
<Struct object at 0x7fec04763180>
Python 2.7:
>>> import struct
>>> struct.Struct(3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Struct() argument 1 must be string, not int
>>> struct.Struct(u'b')
<Struct object at 0x17993e8>
Here is the patch to better error message for Python 3.4 and 3.3. |