File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -401,7 +401,8 @@ def persistent_id(self, obj: object) -> object: # pyright: ignore[reportIncompa
401401
402402 id_ = id (obj )
403403 try :
404- return id_ , seen [id_ ]
404+ kind = seen [id_ ]
405+ return None if kind is None else (id_ , kind )
405406 except KeyError :
406407 pass
407408
@@ -487,19 +488,19 @@ class Unpickler(pickle.Unpickler): # numpydoc ignore=GL01,RT01
487488
488489 @override
489490 def persistent_load (self , pid : tuple [int , int ]) -> object : # pyright: ignore[reportIncompatibleMethodOverride] # numpydoc ignore=GL08
490- prev_id , kind = pid
491491 try :
492- return seen [prev_id ]
492+ return seen [pid ]
493493 except KeyError :
494494 pass
495495
496+ _ , kind = pid
496497 try :
497498 obj = next (iters [kind ])
498499 except StopIteration as e :
499500 msg = "Not enough objects to unpickle"
500501 raise ValueError (msg ) from e
501502
502- seen [prev_id ] = obj
503+ seen [pid ] = obj
503504 return obj
504505
505506 f = io .BytesIO (pik )
You can’t perform that action at this time.
0 commit comments