Just assign a empty collection instead of copy/clear

Instead of copying the '_events_listeners' then clear
them to get a clean copy just set the copies '_events_listeners'
to a new collection in the first place.

Change-Id: I17d4f02241c90a49fc4334cfd1f2fffd03d58927
This commit is contained in:
Joshua Harlow
2014-12-09 15:52:14 -08:00
parent bbeef0b755
commit b275c51a6f

View File

@@ -145,8 +145,7 @@ class BaseTask(atom.Atom):
:return: the copied task
"""
c = copy.copy(self)
c._events_listeners = c._events_listeners.copy()
c._events_listeners.clear()
c._events_listeners = collections.defaultdict(list)
if retain_listeners:
for event_name, listeners in six.iteritems(self._events_listeners):
c._events_listeners[event_name] = listeners[:]