[pypy-svn] r26480 - in pypy/dist/pypy/rpython/ootypesystem: . test
nik at codespeak.net
nik at codespeak.net
Fri Apr 28 04:22:16 CEST 2006
Author: nik
Date: Fri Apr 28 04:22:12 2006
New Revision: 26480
Modified:
pypy/dist/pypy/rpython/ootypesystem/ootype.py
pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py
Log:
get rid of the last traces of ForwardReference in ootypesystem. we should
now have full support for recursive types in ootypesystem.
Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py Fri Apr 28 04:22:12 2006
@@ -465,18 +465,6 @@
VALUETYPE = self._specialize_type(self._VALUETYPE, generic_types)
return self.__class__(KEYTYPE, VALUETYPE)
-
-class ForwardReference(OOType):
- def become(self, real_instance):
- if not isinstance(real_instance, (Instance, BuiltinADTType)):
- raise TypeError("ForwardReference can only be to an instance, "
- "not %r" % (real_instance,))
- self.__class__ = real_instance.__class__
- self.__dict__ = real_instance.__dict__
-
- def __hash__(self):
- raise TypeError("%r object is not hashable" % self.__class__.__name__)
-
# ____________________________________________________________
class _class(object):
Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oolist.py Fri Apr 28 04:22:12 2006
@@ -73,16 +73,14 @@
assert hash(LT) == hash(LT2)
def test_recursive():
- FORWARD = ForwardReference()
- LT = List(FORWARD)
- FORWARD.become(LT)
+ LT = List()
+ setItemType(LT, LT)
assert LT == LT
assert hash(LT) == hash(LT)
str(LT) # make sure this doesn't recurse infinitely
- FORWARD2 = ForwardReference()
- LT2 = List(FORWARD2)
- FORWARD2.become(LT2)
+ LT2 = List()
+ setItemType(LT2, LT2)
assert LT == LT2
assert hash(LT) == hash(LT2)
More information about the Pypy-commit
mailing list