Revision 6a2dfeb4 ncclient/operations/rpc.py

b/ncclient/operations/rpc.py
14 14

  
15 15
from threading import Event, Lock
16 16
from uuid import uuid1
17
from weakref import WeakValueDictionary
18 17

  
19 18
from ncclient import content
20 19
from ncclient.transport import SessionListener
......
188 187
        if instance is None:
189 188
            instance = object.__new__(cls)
190 189
            instance._lock = Lock()
191
            instance._id2rpc = WeakValueDictionary()
190
            instance._id2rpc = {}
192 191
            instance._pipelined = session.can_pipeline
193 192
            session.add_listener(instance)
194 193
        return instance
......
225 224
        rpc.deliver_reply(raw)
226 225

  
227 226
    def errback(self, err):
228
        for rpc in self._id2rpc.values():
229
            rpc.deliver_error(err)
227
        try:
228
            for rpc in self._id2rpc.values():
229
                rpc.deliver_error(err)
230
        finally:
231
            self._id2rpc.clear()
230 232

  
231 233

  
232 234
class RPC(object):

Also available in: Unified diff