From a16c54c0d5b891655bce89e5779e6b9221131ba7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 14 Feb 2012 19:01:16 -0800 Subject: [PATCH] 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. --- pym/_emerge/Scheduler.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) -- 2.26.2