App: fixes #10460: App::PropertyPythonObject is not saving data
Since Py3.11 the methods names __setstate__ and __getstate__ conflict with the method names added to the object class. Thus rename them to 'loads' and 'dumps'
This commit is contained in:
@@ -64,17 +64,17 @@ class DraftLink(DraftObject):
|
||||
if obj:
|
||||
self.attach(obj)
|
||||
|
||||
def __getstate__(self):
|
||||
def dumps(self):
|
||||
"""Return a tuple of all serializable objects or None."""
|
||||
return self.__dict__
|
||||
|
||||
def __setstate__(self, state):
|
||||
def loads(self, state):
|
||||
"""Set some internal properties for all restored objects."""
|
||||
if isinstance(state, dict):
|
||||
self.__dict__ = state
|
||||
else:
|
||||
self.use_link = False
|
||||
super(DraftLink, self).__setstate__(state)
|
||||
super(DraftLink, self).loads(state)
|
||||
|
||||
def attach(self, obj):
|
||||
"""Set up the properties when the object is attached."""
|
||||
|
||||
Reference in New Issue
Block a user