projects
/
portage.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a5adf03
)
Fix config.pop() so that is will properly raise a KeyError.
author
Zac Medico
<zmedico@gentoo.org>
Tue, 27 Nov 2007 02:08:03 +0000
(
02:08
-0000)
committer
Zac Medico
<zmedico@gentoo.org>
Tue, 27 Nov 2007 02:08:03 +0000
(
02:08
-0000)
svn path=/main/trunk/; revision=8704
pym/portage/__init__.py
patch
|
blob
|
history
diff --git
a/pym/portage/__init__.py
b/pym/portage/__init__.py
index 79e559d69253120262f9a6dd9904c4debedf7131..c66a1ab33a13bb38798697ba2cc4cc2c157ac8d4 100644
(file)
--- a/
pym/portage/__init__.py
+++ b/
pym/portage/__init__.py
@@
-2470,11
+2470,18
@@
class config(object):
return d[k]
return x
- def pop(self, k, x=None):
- self.modifying()
- v = x
+ def pop(self, key, *args):
+ if len(args) > 1:
+ raise TypeError(
+ "pop expected at most 2 arguments, got " + \
+ repr(1 + len(args)))
+ v = self
for d in reversed(self.lookuplist):
- v = d.pop(k, v)
+ v = d.pop(key, v)
+ if v is self:
+ if args:
+ return args[0]
+ raise KeyError(key)
return v
def has_key(self,mykey):