Issue #755: YTArray is not pickleable (yt_analysis/yt)

New issue 755: YTArray is not pickleable https://bitbucket.org/yt_analysis/yt/issue/755/ytarray-is-not-pickleable
Nathan Goldbaum:
After applying the following diff:
``` #!diff
diff -r d20587c1602e yt/data_objects/yt_array.py --- a/yt/data_objects/yt_array.py Tue Dec 17 14:35:41 2013 -0500 +++ b/yt/data_objects/yt_array.py Wed Dec 18 14:18:00 2013 -0800 @@ -261,7 +261,7 @@ """
""" - if obj is None: + if obj is None and hasattr(self, 'units'): return self.units = getattr(obj, 'units', None) ```
You can try the following test script which illustrates the problem:
``` #!python
○ cat test_pickle.py from yt.data_objects.yt_array import YTArray as array import cPickle as pickle
arr = array([1,2,3], 'g')
with open('save.p', 'wb') as f: pickle.dump(arr, f)
with open('save.p', 'rb') as f: data_read = pickle.load(f)
print arr print data_read ```
On my machine, this prints:
``` [1 2 3] g [1 2 3] None ```
This is related to #754 and #743.
participants (1)
-
Nathan Goldbaum