[pypy-svn] r29521 - pypy/dist/pypy/objspace/cpy/test
rxe at codespeak.net
rxe at codespeak.net
Fri Jun 30 03:30:26 CEST 2006
Author: rxe
Date: Fri Jun 30 03:30:10 2006
New Revision: 29521
Modified:
pypy/dist/pypy/objspace/cpy/test/test_typedef.py
Log:
Banged my head against a wall for an entire day - can anyone help me please!
:-)
Seems like we have trouble specializing wrap() if there is more than user
defined class to wrap.
Modified: pypy/dist/pypy/objspace/cpy/test/test_typedef.py
==============================================================================
--- pypy/dist/pypy/objspace/cpy/test/test_typedef.py (original)
+++ pypy/dist/pypy/objspace/cpy/test/test_typedef.py Fri Jun 30 03:30:10 2006
@@ -1,4 +1,5 @@
import py
+import py.test
from pypy.interpreter.error import OperationError
from pypy.interpreter.baseobjspace import Wrappable
from pypy.interpreter.typedef import TypeDef
@@ -52,6 +53,31 @@
assert type(res).__name__ == 'MyType'
+def test_get_blackboxes():
+ py.test.skip("a bug with specialize:wrap?")
+ W_MyType.typedef = TypeDef("MyType")
+
+ class W_MyType2(Wrappable):
+ def __init__(self, space, x=1):
+ self.space = space
+ self.x = x
+ W_MyType2.typedef = TypeDef("MyType2")
+ space = CPyObjSpace()
+
+ def make_mytype(n):
+ if n:
+ return space.wrap(W_MyType2(space))
+ else:
+ return space.wrap(W_MyType(space))
+ fn = compile(make_mytype, [int],
+ annotatorpolicy = CPyAnnotatorPolicy(space))
+
+ res = fn(1, expected_extra_mallocs=1)
+ assert type(res).__name__ == 'MyType'
+ res = fn(0, expected_extra_mallocs=1)
+ assert type(res).__name__ == 'MyType2'
+
+
def test_blackbox():
W_MyType.typedef = TypeDef("MyType")
space = CPyObjSpace()
More information about the Pypy-commit
mailing list