[issue19099] struct.pack fails first time with unicode fmt
Vajrasky Kok
report at bugs.python.org
Sat Dec 14 05:13:50 CET 2013
Vajrasky Kok added the comment:
Okay, I think the error message can be improved because in Python 2.7 we differentiate very clearly the string from the unicode.
>>> import struct
>>> struct.Struct(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Struct() argument 1 must be string, not int
But you can give unicode, right?
>>> struct.Struct(u'b')
<Struct object at 0x1f484b8>
This is consistent with other example:
>>> " cutecat ".strip(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: strip arg must be None, str or unicode
What do you say, Serhiy?
Here is the patch.
----------
Added file: http://bugs.python.org/file33126/fix_error_message_struct_Struct.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19099>
_______________________________________
More information about the Python-bugs-list
mailing list