[pypy-svn] r73120 - in pypy/branch/reduce-instance-size-experiments/pypy/objspace/std: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Mon Mar 29 20:16:20 CEST 2010
Author: cfbolz
Date: Mon Mar 29 20:16:19 2010
New Revision: 73120
Modified:
pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/sharingdict.py
pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/test/test_sharingdict.py
Log:
pf, don't erase subclasses of int
Modified: pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/sharingdict.py
==============================================================================
--- pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/sharingdict.py (original)
+++ pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/sharingdict.py Mon Mar 29 20:16:19 2010
@@ -94,15 +94,13 @@
return structure.find_structure_del_key(num_back)
-
-
def erase(space, w_value):
if not space.config.objspace.std.withsharingtaggingdict:
return w_value
from pypy.rlib.rerased import erase
if w_value is None:
return erase(w_value)
- if space.is_true(space.isinstance(w_value, space.w_int)):
+ if space.is_w(space.type(w_value), space.w_int):
val = space.int_w(w_value)
try:
return erase(val)
@@ -162,8 +160,8 @@
attr.setfield(self.entries, w_value)
return
new_structure = self.structure.get_next_structure(key)
- self.entries = self.structure.convert_to(new_structure, self.entries)
attr = new_structure.lookup_attribute(key)
+ self.entries = self.structure.convert_to(new_structure, self.entries)
attr.setfield(self.entries, w_value)
self.structure = new_structure
Modified: pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/test/test_sharingdict.py
==============================================================================
--- pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/test/test_sharingdict.py (original)
+++ pypy/branch/reduce-instance-size-experiments/pypy/objspace/std/test/test_sharingdict.py Mon Mar 29 20:16:19 2010
@@ -36,6 +36,23 @@
def key_positions(d):
return dict([(key, attr.index) for key, attr in d.structure.keys.items()])
+def test_erase_int_subclass():
+ class FakeSpace:
+ class config:
+ class objspace:
+ class std:
+ withsharingdict = True
+ withsharingtaggingdict = True
+ is_true = bool
+ isinstance = isinstance
+ w_int = int
+ int_w = int
+ wrap = lambda self, x: x
+ is_w = lambda self, a, b: a is b
+ type = type
+ space = FakeSpace()
+ assert unerase(space, erase(space, True)) is True
+
def test_delete():
space = FakeSpace()
d = SharedDictImplementation(space)
More information about the Pypy-commit
mailing list