Author: Carl Friedrich Bolz <[email protected]>
Branch: remove-objspace-options
Changeset: r83840:cfcb4f157e44
Date: 2016-04-24 17:13 +0300
http://bitbucket.org/pypy/pypy/changeset/cfcb4f157e44/
Log: various fixes for translation and tests
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -163,6 +163,7 @@
user_overridden_class = True
for base in mixins_needed:
objectmodel.import_from_mixin(base)
+ del subcls.base
subcls.__name__ = name
return subcls
diff --git a/pypy/module/__pypy__/test/test_special.py
b/pypy/module/__pypy__/test/test_special.py
--- a/pypy/module/__pypy__/test/test_special.py
+++ b/pypy/module/__pypy__/test/test_special.py
@@ -1,8 +1,7 @@
import py
class AppTest(object):
- spaceconfig = {"objspace.usemodules.select": False,
- "objspace.std.withrangelist": True}
+ spaceconfig = {"objspace.usemodules.select": False}
def setup_class(cls):
if cls.runappdirect:
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -579,15 +579,15 @@
@objectmodel.dont_inline
def _obj_setdict(self, space, w_dict):
- from pypy.objspace.std import dictmultiobject
+ from pypy.interpreter.error import OperationError
terminator = self._get_mapdict_map().terminator
assert isinstance(terminator, DictTerminator) or isinstance(terminator,
DevolvedDictTerminator)
if not space.isinstance_w(w_dict, space.w_dict):
raise OperationError(space.w_TypeError,
space.wrap("setting dictionary to a non-dict"))
- assert isinstance(w_dict, dictmultiobject.W_DictMultiObject)
+ assert isinstance(w_dict, W_DictMultiObject)
w_olddict = self.getdict(space)
- assert isinstance(w_dict, W_DictMultiObject)
+ assert isinstance(w_olddict, W_DictMultiObject)
# The old dict has got 'self' as dstorage, but we are about to
# change self's ("dict", SPECIAL) attribute to point to the
# new dict. If the old dict was using the MapDictStrategy, we
@@ -617,11 +617,22 @@
self.storage = storage
self.map = map
-class ObjectWithoutDict(MapdictStorageMixin, BaseUserClassMapdict,
MapdictWeakrefSupport, W_Root):
- pass # mainly for tests
+class ObjectWithoutDict(W_Root):
+ # mainly for tests
+ objectmodel.import_from_mixin(MapdictStorageMixin)
-class Object(MapdictStorageMixin, BaseUserClassMapdict, MapdictDictSupport,
MapdictWeakrefSupport, W_Root):
- pass # mainly for tests
+ objectmodel.import_from_mixin(BaseUserClassMapdict)
+ objectmodel.import_from_mixin(MapdictWeakrefSupport)
+
+
+class Object(W_Root):
+ # mainly for tests
+ objectmodel.import_from_mixin(MapdictStorageMixin)
+
+ objectmodel.import_from_mixin(BaseUserClassMapdict)
+ objectmodel.import_from_mixin(MapdictWeakrefSupport)
+ objectmodel.import_from_mixin(MapdictDictSupport)
+
SUBCLASSES_NUM_FIELDS = 5
diff --git a/pypy/objspace/std/test/test_mapdict.py
b/pypy/objspace/std/test/test_mapdict.py
--- a/pypy/objspace/std/test/test_mapdict.py
+++ b/pypy/objspace/std/test/test_mapdict.py
@@ -599,15 +599,20 @@
def test_specialized_class():
+ from pypy.objspace.std.mapdict import _make_storage_mixin_size_n
from pypy.objspace.std.objectobject import W_ObjectObject
- classes = memo_get_subclass_of_correct_size(space, W_ObjectObject)
+ classes = [_make_storage_mixin_size_n(i) for i in range(2, 10)]
w1 = W_Root()
w2 = W_Root()
w3 = W_Root()
w4 = W_Root()
w5 = W_Root()
w6 = W_Root()
- for objectcls in classes:
+ for mixin in classes:
+ class objectcls(W_ObjectObject):
+ objectmodel.import_from_mixin(BaseUserClassMapdict)
+ objectmodel.import_from_mixin(MapdictDictSupport)
+ objectmodel.import_from_mixin(mixin)
cls = Class()
obj = objectcls()
obj.user_setup(space, cls)
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -535,7 +535,7 @@
def add_subclass(w_self, w_subclass):
space = w_self.space
if not space.config.translation.rweakref:
- self.weak_subclasses.append(w_subclass) # not really weak, but well
+ w_self.weak_subclasses.append(w_subclass) # not really weak, but
well
return
import weakref
assert isinstance(w_subclass, W_TypeObject)
@@ -566,7 +566,7 @@
def get_subclasses(w_self):
space = w_self.space
if not space.config.translation.rweakref:
- return self.weak_subclasses[:]
+ return w_self.weak_subclasses[:]
subclasses_w = []
for ref in w_self.weak_subclasses:
w_ob = ref()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit