[pypy-svn] pypy new-dict-proxy: kill from_strdict_shared
cfbolz
commits-noreply at bitbucket.org
Mon Apr 18 14:09:33 CEST 2011
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: new-dict-proxy
Changeset: r43446:6ee045ccb063
Date: 2011-04-17 09:40 +0200
http://bitbucket.org/pypy/pypy/changeset/6ee045ccb063/
Log: kill from_strdict_shared
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -615,7 +615,7 @@
if w_obj.is_cpytype():
Py_DecRef(space, pto.c_tp_dict)
- w_dict = space.newdict(from_strdict_shared=w_obj.dict_w)
+ w_dict = w_obj.getdict(space)
pto.c_tp_dict = make_ref(space, w_dict)
@cpython_api([PyTypeObjectPtr, PyTypeObjectPtr], rffi.INT_real, error=CANNOT_FAIL)
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
@@ -34,13 +34,7 @@
@staticmethod
def allocate_and_init_instance(space, w_type=None, module=False,
instance=False, classofinstance=None,
- from_strdict_shared=None, strdict=False):
- if from_strdict_shared is not None:
- assert w_type is None
- assert not module and not instance and classofinstance is None
- w_self = StrDictImplementation(space)
- w_self.content = from_strdict_shared
- return w_self
+ strdict=False):
if space.config.objspace.std.withcelldict and module:
from pypy.objspace.std.celldict import ModuleDictImplementation
assert w_type is None
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
@@ -131,25 +131,6 @@
assert self.space.eq_w(space.call_function(get, w("33")), w(None))
assert self.space.eq_w(space.call_function(get, w("33"), w(44)), w(44))
- def test_initialize_from_strdict_shared(self):
- space = self.space
- w = space.wrap
- d = {"a": w(1), "b": w(2)}
- w_d = space.newdict(from_strdict_shared=d)
- assert self.space.eq_w(space.getitem(w_d, w("a")), w(1))
- assert self.space.eq_w(space.getitem(w_d, w("b")), w(2))
-
- def test_initialize_from_strdict_really_shared(self):
- space = self.space
- w = space.wrap
- d = {"a": w(1), "b": w(2)}
- w_d = space.newdict(from_strdict_shared=d)
- assert self.space.eq_w(space.getitem(w_d, w("a")), w(1))
- assert self.space.eq_w(space.getitem(w_d, w("b")), w(2))
- d["c"] = w(41)
- assert self.space.eq_w(space.getitem(w_d, w("c")), w(41))
-
-
class AppTest_DictObject:
@@ -766,12 +747,10 @@
def newtuple(self, l):
return tuple(l)
- def newdict(self, module=False, instance=False, classofinstance=None,
- from_strdict_shared=None):
+ def newdict(self, module=False, instance=False, classofinstance=None):
return W_DictMultiObject.allocate_and_init_instance(
self, module=module, instance=instance,
- classofinstance=classofinstance,
- from_strdict_shared=from_strdict_shared)
+ classofinstance=classofinstance)
def finditem_str(self, w_dict, s):
return w_dict.getitem_str(s) # assume it's a multidict
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
@@ -303,11 +303,10 @@
return W_ListObject(list_w)
def newdict(self, module=False, instance=False, classofinstance=None,
- from_strdict_shared=None, strdict=False):
+ strdict=False):
return W_DictMultiObject.allocate_and_init_instance(
self, module=module, instance=instance,
classofinstance=classofinstance,
- from_strdict_shared=from_strdict_shared,
strdict=strdict)
def newslice(self, w_start, w_end, w_step):
More information about the Pypy-commit
mailing list