File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,30 @@ def default(self, o):
7373 mutate_self = False ,
7474 )
7575 if isinstance (obj , Flight ):
76- obj ._Flight__evaluate_post_process ()
77- solution = np .array (obj .solution )
76+ try :
77+ evaluate_post_process = getattr (obj , '_Flight__evaluate_post_process' , None )
78+
79+ # Check if it's corrupted (numpy array instead of cached_property)
80+ if isinstance (evaluate_post_process , np .ndarray ):
81+ try :
82+ delattr (obj , '_Flight__evaluate_post_process' )
83+
84+ restored_method = getattr (obj , '_Flight__evaluate_post_process' , None )
85+ if restored_method and callable (restored_method ):
86+ restored_method ()
87+ except Exception as fix_error :
88+ logger .error (f"Error fixing _Flight__evaluate_post_process: { fix_error } " )
89+
90+ elif evaluate_post_process is not None and callable (evaluate_post_process ):
91+ evaluate_post_process ()
92+
93+ except (AttributeError , TypeError , ValueError ) as e :
94+ logger .error (f"Error handling Flight object corruption: { e } " )
95+
96+ try :
97+ solution = np .array (obj .solution )
98+ except Exception as e :
99+ return super ().default (obj ) # Fall back to parent encoder
78100 size = len (solution )
79101 if size > 25 :
80102 reduction_factor = size // 25
You can’t perform that action at this time.
0 commit comments