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

unOps can't be pickled #366

Closed
guyer opened this issue Sep 19, 2014 · 2 comments
Closed

unOps can't be pickled #366

guyer opened this issue Sep 19, 2014 · 2 comments

Comments

@guyer
Copy link
Member

guyer commented Sep 19, 2014

Pickling a unary operator fails

>>> import fipy as fp
>>> fp.dump.write(-fp.Variable(3.), filename="test.tar.gz")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "fipy/tools/dump.py", line 83, in write
cPickle.dump(data, fileStream, 0)
cPickle.PicklingError: Can't pickle <class 'fipy.variables.unaryOperatorVariable.unOp'>: attribute lookup fipy.variables.unaryOperatorVariable.unOp failed

This was resolved for binOps a long time ago (6500819 (binops can now be pickled)), but not for unOps

Imported from trac ticket #492, created by guyer on 01-24-2013 at 15:56, last modified: 01-25-2013 at 12:27

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

The following changes since commit 2636902f227032176c7ee4cbfbcf747e1f425919:

  Merge branch 'ticket491-rename-communicator-instances' into develop (2013-01-23 12:04:07 -0500)

are available in the git repository at:


  ssh://git@code.matforge.org/nist/fipy.git ticket492-unOps_cant_be_pickled

for you to fetch changes up to b5927d32ffc9833636e18879146cc1ec9115e3fe:

  and unOp test to test suite (2013-01-24 16:09:43 -0500)

----------------------------------------------------------------
Jonathan Guyer (3):
add test for issue #366
move `__reduce__()` method to common base class
and unOp test to test suite

 fipy/variables/binaryOperatorVariable.py | 14 +-------------
 fipy/variables/operatorVariable.py       | 12 ++++++++++++
 fipy/variables/test.py                   |  1 +
 fipy/variables/unaryOperatorVariable.py  | 34 ++++++++++++++++++++++++++++++++++
 4 files changed, 48 insertions(+), 13 deletions(-)

Trac comment by guyer on 01-24-2013 at 16:16

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

Merged with bca401e

Trac comment by wd15 on 01-25-2013 at 12:27

@guyer guyer closed this as completed Sep 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants