Index: trellis.py =================================================================== --- trellis.py (revision 2599) +++ trellis.py (working copy) @@ -1,10 +1,22 @@ from thread import get_ident from weakref import ref from peak.util import addons, decorators -import sys, UserDict, UserList, sets, stm, types, new, weakref, copy +import sys, UserDict, UserList, stm, types, new, weakref, copy from peak.util.extremes import Max from peak.util.symbols import Symbol, NOT_GIVEN +if sys.version >= '2.6': + import warnings + _filter = ('ignore', None, DeprecationWarning, None, 13) # lineno for 'import sets' + warnings.filters.append(_filter) +try: + import sets +finally: + if sys.version >= '2.6': + if warnings.filters.pop(-1) is not _filter: + raise AssertionError + + __all__ = [ 'Cell', 'Constant', 'make', 'todo', 'todos', 'modifier', 'Component', 'repeat', 'poll', 'InputConflict', @@ -292,8 +308,8 @@ a rule, reads performed in the function will not become dependencies of the caller. """ - def wrap(__func, __module): - """ + def wrap(__func, __module): pass + wrap.__doc__ = """ if not __module.ctrl.active: return __module.atomically(__func, $args) elif __module.ctrl.current_listener is None: @@ -748,6 +763,9 @@ except KeyError: name = self.__name__ cell = cells.setdefault(name, self.make_cell(typ, ob, name)) + if ctrl.active: + on_undo(cells.pop, name) return cell.value def __repr__(self): @@ -1240,6 +1258,9 @@ strategy is used in each recalcultion that changes the list. If what you really want is e.g. a sorted read-only view on a set, don't use this. """ + if hasattr(UserList.UserList, '__metaclass__'): + class __metaclass__(Component.__metaclass__, UserList.UserList.__metaclass__): + pass updated = todo(lambda self: self.data[:]) future = updated.future