From: Zac Medico Date: Wed, 15 Feb 2012 03:01:16 +0000 (-0800) Subject: Scheduler: PyPy WeakValueDictionary.pop KeyError X-Git-Tag: v2.2.0_alpha87~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a16c54c0d5b891655bce89e5779e6b9221131ba7;p=portage.git Scheduler: PyPy WeakValueDictionary.pop KeyError KeyError observed from WeakValueDictionary.pop() with PyPy 1.8, despite None given as default. Note that PyPy 1.8 has the same WeakValueDictionary code as CPython 2.7, so it may be possible for CPython to raise KeyError here as well. --- diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 4b3702667..c797c3241 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1620,7 +1620,14 @@ class Scheduler(PollScheduler): "installed", pkg.root_config, installed=True, operation="uninstall") - prefetcher = self._prefetchers.pop(pkg, None) + try: + prefetcher = self._prefetchers.pop(pkg, None) + except KeyError: + # KeyError observed with PyPy 1.8, despite None given as default. + # Note that PyPy 1.8 has the same WeakValueDictionary code as + # CPython 2.7, so it may be possible for CPython to raise KeyError + # here as well. + prefetcher = None if prefetcher is not None and not prefetcher.isAlive(): try: self._task_queues.fetch._task_queue.remove(prefetcher)