[issue29628] struct objects can no longer be pickled
mesheb82
report at bugs.python.org
Wed Feb 22 22:55:46 EST 2017
New submission from mesheb82:
When I run the following code on Windows/Linux for < Python 3.6, I have no problems. When I run in Python 3.6.0, I get the subsequent traceback.
I checked the release notes and only saw the following struct module note related to half-floats: Issue #11734
from struct import Struct
import copy
this_fails = Struct('<i')
copy.deepcopy(this_fails)
Traceback (most recent call last):
File "test_script.py", line 12, in <module>
copy.deepcopy(this_fails)
File "F:\Anaconda\envs\py36\lib\copy.py", line 169, in deepcopy
rv = reductor(4)
TypeError: can't pickle Struct objects
To be clear, I'm copying struct objects as part of a larger class. As I'm running many function calls where I create the same struct objects, saving the common struct objects allows me to get a factor of 2x speedup on my code. Deleting the saved struct objects at the end of file reading (and before the deepcopy takes place) fixes the problem.
----------
components: Windows
messages: 288401
nosy: mesheb82, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: struct objects can no longer be pickled
type: crash
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29628>
_______________________________________
More information about the Python-bugs-list
mailing list