1 |
commit: a16c54c0d5b891655bce89e5779e6b9221131ba7 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 15 03:01:16 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 15 03:01:16 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a16c54c0 |
7 |
|
8 |
Scheduler: PyPy WeakValueDictionary.pop KeyError |
9 |
|
10 |
KeyError observed from WeakValueDictionary.pop() with PyPy 1.8, |
11 |
despite None given as default. Note that PyPy 1.8 has the same |
12 |
WeakValueDictionary code as CPython 2.7, so it may be possible for |
13 |
CPython to raise KeyError here as well. |
14 |
|
15 |
--- |
16 |
pym/_emerge/Scheduler.py | 9 ++++++++- |
17 |
1 files changed, 8 insertions(+), 1 deletions(-) |
18 |
|
19 |
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py |
20 |
index 4b37026..c797c32 100644 |
21 |
--- a/pym/_emerge/Scheduler.py |
22 |
+++ b/pym/_emerge/Scheduler.py |
23 |
@@ -1620,7 +1620,14 @@ class Scheduler(PollScheduler): |
24 |
"installed", pkg.root_config, installed=True, |
25 |
operation="uninstall") |
26 |
|
27 |
- prefetcher = self._prefetchers.pop(pkg, None) |
28 |
+ try: |
29 |
+ prefetcher = self._prefetchers.pop(pkg, None) |
30 |
+ except KeyError: |
31 |
+ # KeyError observed with PyPy 1.8, despite None given as default. |
32 |
+ # Note that PyPy 1.8 has the same WeakValueDictionary code as |
33 |
+ # CPython 2.7, so it may be possible for CPython to raise KeyError |
34 |
+ # here as well. |
35 |
+ prefetcher = None |
36 |
if prefetcher is not None and not prefetcher.isAlive(): |
37 |
try: |
38 |
self._task_queues.fetch._task_queue.remove(prefetcher) |