Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pickle protocol 2 for Vec3 #69

Merged
merged 1 commit into from
Jul 22, 2013

Conversation

rmcgibbo
Copy link
Contributor

Currently, vec3 doesn't support the highest protocol for pickle. This PR adds support, via this magic method.

>>> # current master
>>> import pickle
>>> import simtk.openmm as mm
>>> vec3 = mm.Vec3(1,1,1)
>>> assert vec3 == pickle.loads(pickle.dumps(vec3, pickle.HIGHEST_PROTOCOL))
Traceback (most recent call last):
  File "f.py", line 5, in <module>
    assert vec3 == pickle.loads(pickle.dumps(vec3, pickle.HIGHEST_PROTOCOL))
  File "/home/rmcgibbo/opt/python/2.7.5/lib/python2.7/pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "/home/rmcgibbo/opt/python/2.7.5/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/home/rmcgibbo/opt/python/2.7.5/lib/python2.7/pickle.py", line 1083, in load_newobj
    obj = cls.__new__(cls, *args)
TypeError: __new__() takes exactly 4 arguments (2 given)

peastman added a commit that referenced this pull request Jul 22, 2013
Add support for pickle protocol 2 for Vec3
@peastman peastman merged commit 99df675 into openmm:master Jul 22, 2013
@rmcgibbo rmcgibbo deleted the pickle2-vec3 branch August 9, 2013 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants