File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -198,8 +198,10 @@ def __str__(self):
198198
199199 def __getstate__ (self ):
200200 state = self .__dict__ .copy ()
201- state ["input_spec" ] = cp .dumps (state ["input_spec" ])
202- state ["output_spec" ] = cp .dumps (state ["output_spec" ])
201+ if "input_spec" in state :
202+ state ["input_spec" ] = cp .dumps (state ["input_spec" ])
203+ if "output_spec" in state :
204+ state ["output_spec" ] = cp .dumps (state ["output_spec" ])
203205 inputs = {}
204206 for k , v in attr .asdict (state ["inputs" ]).items ():
205207 if k .startswith ("_" ):
@@ -209,9 +211,12 @@ def __getstate__(self):
209211 return state
210212
211213 def __setstate__ (self , state ):
212- state ["input_spec" ] = cp .loads (state ["input_spec" ])
213- state ["output_spec" ] = cp .loads (state ["output_spec" ])
214- state ["inputs" ] = make_klass (state ["input_spec" ])(** state ["inputs" ])
214+ if "input_spec" in state :
215+ state ["input_spec" ] = cp .loads (state ["input_spec" ])
216+ if "output_spec" in state :
217+ state ["output_spec" ] = cp .loads (state ["output_spec" ])
218+ input_spec = state .get ("input_spec" , self .input_spec )
219+ state ["inputs" ] = make_klass (input_spec )(** state ["inputs" ])
215220 self .__dict__ .update (state )
216221
217222 def __getattr__ (self , name ):
You can’t perform that action at this time.
0 commit comments