[pypy-commit] pypy default: merge
cfbolz
noreply at buildbot.pypy.org
Sat Apr 7 15:04:29 CEST 2012
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch:
Changeset: r54235:f016b819e011
Date: 2012-04-07 15:03 +0200
http://bitbucket.org/pypy/pypy/changeset/f016b819e011/
Log: merge
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -321,7 +321,7 @@
def user_setup(self, space, w_subtype):
self.w__dict__ = space.newdict(
- instance=True, classofinstance=w_subtype)
+ instance=True)
base_user_setup(self, space, w_subtype)
def setclass(self, space, w_subtype):
diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -110,7 +110,7 @@
"NOT_RPYTHON"
raise NotImplementedError
- def newdict(self, module=False, instance=False, classofinstance=None,
+ def newdict(self, module=False, instance=False,
strdict=False):
return w_some_obj()
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -33,8 +33,7 @@
@staticmethod
def allocate_and_init_instance(space, w_type=None, module=False,
- instance=False, classofinstance=None,
- strdict=False):
+ instance=False, strdict=False):
if space.config.objspace.std.withcelldict and module:
from pypy.objspace.std.celldict import ModuleDictStrategy
@@ -563,10 +562,7 @@
def listview_int(self, w_dict):
return self.unerase(w_dict.dstorage).keys()
- def w_keys(self, w_dict):
- # XXX there is no space.newlist_int yet
- space = self.space
- return space.call_function(space.w_list, w_dict)
+ # XXX there is no space.newlist_int yet to implement w_keys more efficiently
class IntIteratorImplementation(_WrappedIteratorMixin, IteratorImplementation):
pass
diff --git a/pypy/objspace/std/identitydict.py b/pypy/objspace/std/identitydict.py
--- a/pypy/objspace/std/identitydict.py
+++ b/pypy/objspace/std/identitydict.py
@@ -1,5 +1,5 @@
## ----------------------------------------------------------------------------
-## dict strategy (see dict_multiobject.py)
+## dict strategy (see dictmultiobject.py)
from pypy.rlib import rerased
from pypy.rlib.debug import mark_dict_non_null
@@ -80,8 +80,8 @@
def iter(self, w_dict):
return IdentityDictIteratorImplementation(self.space, self, w_dict)
- def keys(self, w_dict):
- return self.unerase(w_dict.dstorage).keys()
+ def w_keys(self, w_dict):
+ return self.space.newlist(self.unerase(w_dict.dstorage).keys())
class IdentityDictIteratorImplementation(_UnwrappedIteratorMixin, IteratorImplementation):
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -313,11 +313,10 @@
def newlist_str(self, list_s):
return W_ListObject.newlist_str(self, list_s)
- def newdict(self, module=False, instance=False, classofinstance=None,
+ def newdict(self, module=False, instance=False,
strdict=False):
return W_DictMultiObject.allocate_and_init_instance(
self, module=module, instance=instance,
- classofinstance=classofinstance,
strdict=strdict)
def newset(self):
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -885,10 +885,9 @@
def newtuple(self, l):
return tuple(l)
- def newdict(self, module=False, instance=False, classofinstance=None):
+ def newdict(self, module=False, instance=False):
return W_DictMultiObject.allocate_and_init_instance(
- self, module=module, instance=instance,
- classofinstance=classofinstance)
+ self, module=module, instance=instance)
def finditem_str(self, w_dict, s):
return w_dict.getitem_str(s) # assume it's a multidict
@@ -968,6 +967,20 @@
assert type(self.impl.strategy) is self.StrategyClass
#assert self.impl.r_dict_content is None
+ def test_popitem(self):
+ self.fill_impl()
+ assert self.impl.length() == 2
+ a, b = self.impl.popitem()
+ assert self.impl.length() == 1
+ if a == self.string:
+ assert b == 1000
+ assert self.impl.getitem(self.string2) == 2000
+ else:
+ assert a == self.string2
+ assert b == 2000
+ assert self.impl.getitem_str(self.string) == 1000
+ self.check_not_devolved()
+
def test_setitem(self):
self.impl.setitem(self.string, 1000)
assert self.impl.length() == 1
More information about the pypy-commit
mailing list