[issue29628] struct objects can no longer be pickled
Serhiy Storchaka
report at bugs.python.org
Thu Feb 23 00:22:51 EST 2017
Serhiy Storchaka added the comment:
> When I run the following code on Windows/Linux for < Python 3.6, I have no problems.
You have a problem. Did you try to use the copied object? It is a broken Struct object.
>>> copied = copy.deepcopy(this_fails)
>>> copied.format
>>> copied.size
-1
>>> copied.pack(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: pack expected -1 items for packing (got 1)
>>> copied.unpack(b'abcd')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
struct.error: unpack requires a bytes object of length -1
Copying Struct object never worked. Now it raises an error rather than silently creating a broken object.
----------
nosy: +serhiy.storchaka
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29628>
_______________________________________
More information about the Python-bugs-list
mailing list