mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-29 11:51:14 +00:00
Fixed deserialization to handle the start_addr to origin renaming
This commit is contained in:
parent
ff937ebcc0
commit
50a66a2dc9
@ -505,6 +505,7 @@ class DefaultSegment(object):
|
|||||||
self.can_resize = state.pop('can_resize', self.__class__.can_resize_default)
|
self.can_resize = state.pop('can_resize', self.__class__.can_resize_default)
|
||||||
self.restore_missing_serializable_defaults()
|
self.restore_missing_serializable_defaults()
|
||||||
self.__dict__.update(state)
|
self.__dict__.update(state)
|
||||||
|
self.restore_renamed_serializable_attributes()
|
||||||
|
|
||||||
def restore_missing_serializable_defaults(self):
|
def restore_missing_serializable_defaults(self):
|
||||||
"""Hook for the future when extra serializable attributes are added to
|
"""Hook for the future when extra serializable attributes are added to
|
||||||
@ -513,6 +514,17 @@ class DefaultSegment(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def restore_renamed_serializable_attributes(self):
|
||||||
|
"""Hook for the future if attributes have been renamed. The old
|
||||||
|
attribute names will have been restored in the __dict__.update in
|
||||||
|
__setstate__, so this routine should move attribute values to their new
|
||||||
|
names.
|
||||||
|
"""
|
||||||
|
if hasattr(self, 'start_addr'):
|
||||||
|
self.origin = self.start_addr
|
||||||
|
print(f"moving start_addr to origin: {self.start_addr}")
|
||||||
|
delattr(self, 'start_addr')
|
||||||
|
|
||||||
def reconstruct_raw(self, rawdata):
|
def reconstruct_raw(self, rawdata):
|
||||||
"""Reconstruct the pointers to the parent data arrays
|
"""Reconstruct the pointers to the parent data arrays
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user