[issue19099] struct.pack fails first time with unicode fmt

Vajrasky Kok report at bugs.python.org
Mon Sep 30 17:29:25 CEST 2013


Vajrasky Kok added the comment:

Here's the preliminary patch. I am assuming that we should accept unicode argument not reject it straight away.

Python3 does that.
>>> import struct
>>> struct.pack('b', 3)
b'\x03'
>>> struct.pack(b'b', 3)
b'\x03'
>>> struct.pack(b'\xff', 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
struct.error: bad char in struct format

----------
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file31922/handle_ascii_range_unicode_in_struct_pack.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19099>
_______________________________________


More information about the Python-bugs-list mailing list