提交 ac62de29 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

corrected bug in DestroyHandler

上级 17c4dbdd
......@@ -156,7 +156,7 @@ class DestroyHandlerHelper2(toolbox.Bookkeeper):
self.debug_all_apps.remove(app)
#UPDATE self.clients
for i, input in enumerate(app.inputs):
for i, input in enumerate(set(app.inputs)):
del self.clients[input][app]
if getattr(app.op, 'destroy_map', {}):
......
......@@ -227,6 +227,7 @@ class Env(utils.object2):
For each feature that has a 'on_change_input' method, calls:
feature.on_change_input(env, node, i, old_r, new_r)
"""
# TODO: ERROR HANDLING FOR LISTENERS (should it complete the change or revert it?)
if node == 'output':
r = self.outputs[i]
if not r.type == new_r.type:
......
from functools import partial
import graph
import sys
class AlreadyThere(Exception):
......@@ -97,7 +98,12 @@ class ReplaceValidate(History, Validator):
def replace_all_validate(self, env, replacements):
chk = env.checkpoint()
for r, new_r in replacements:
env.replace(r, new_r)
try:
env.replace(r, new_r)
except Exception, e:
print >>sys.stderr, "<<!! BUG IN ENV.REPLACE OR A LISTENER !!>>", type(e), e
env.revert(chk) # this might fail; env.replace should never raise an exception (it kinda needs better internal error handling)
raise
try:
env.validate()
except:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论