提交 c98f2e48 authored 作者: Frederic's avatar Frederic

Fix more pickling of FunctionGraph

上级 55bd12ce
...@@ -662,6 +662,7 @@ class DestroyHandler(toolbox.Bookkeeper): ...@@ -662,6 +662,7 @@ class DestroyHandler(toolbox.Bookkeeper):
The following data structures remain to be converted: The following data structures remain to be converted:
<unknown> <unknown>
""" """
pickle_rm_attr = ["destroyers"]
def __init__(self, do_imports_on_attach=True): def __init__(self, do_imports_on_attach=True):
self.fgraph = None self.fgraph = None
...@@ -720,15 +721,7 @@ class DestroyHandler(toolbox.Bookkeeper): ...@@ -720,15 +721,7 @@ class DestroyHandler(toolbox.Bookkeeper):
" or in conflict with another plugin.") " or in conflict with another plugin.")
####### Annotate the FunctionGraph ############ ####### Annotate the FunctionGraph ############
self.unpickle(fgraph)
def get_destroyers_of(r):
droot, impact, root_destroyer = self.refresh_droot_impact()
try:
return [root_destroyer[droot[r]]]
except Exception:
return []
fgraph.destroyers = get_destroyers_of
fgraph.destroy_handler = self fgraph.destroy_handler = self
self.fgraph = fgraph self.fgraph = fgraph
...@@ -743,6 +736,15 @@ class DestroyHandler(toolbox.Bookkeeper): ...@@ -743,6 +736,15 @@ class DestroyHandler(toolbox.Bookkeeper):
if self.do_imports_on_attach: if self.do_imports_on_attach:
toolbox.Bookkeeper.on_attach(self, fgraph) toolbox.Bookkeeper.on_attach(self, fgraph)
def unpickle(self, fgraph):
def get_destroyers_of(r):
droot, impact, root_destroyer = self.refresh_droot_impact()
try:
return [root_destroyer[droot[r]]]
except Exception:
return []
fgraph.destroyers = get_destroyers_of
def refresh_droot_impact(self): def refresh_droot_impact(self):
""" """
Makes sure self.droot, self.impact, and self.root_destroyer are Makes sure self.droot, self.impact, and self.root_destroyer are
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论