[pypy-svn] r23926 - in pypy/dist/pypy: annotation rpython/rctypes rpython/rctypes/test
goden at codespeak.net
goden at codespeak.net
Thu Mar 2 19:25:46 CET 2006
Author: goden
Date: Thu Mar 2 19:25:37 2006
New Revision: 23926
Modified:
pypy/dist/pypy/annotation/binaryop.py
pypy/dist/pypy/rpython/rctypes/rarray.py
pypy/dist/pypy/rpython/rctypes/test/test_rarray.py
Log:
(arigo, goden) - renabled some rarray tests after teaching annotation/binaryop.py about values in the extregistry to correctly convert c_longs returned by array indexing to ints.
Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py (original)
+++ pypy/dist/pypy/annotation/binaryop.py Thu Mar 2 19:25:37 2006
@@ -16,9 +16,11 @@
from pypy.annotation.model import SomeCTypesObject
from pypy.annotation.model import unionof, UnionError, set, missing_operation, TLS
from pypy.annotation.model import add_knowntypedata, merge_knowntypedata
+from pypy.annotation.model import lltype_to_annotation
from pypy.annotation.bookkeeper import getbookkeeper
from pypy.objspace.flow.model import Variable
from pypy.annotation.listdef import ListDef
+from pypy.rpython import extregistry
# convenience only!
def immutablevalue(x):
@@ -761,6 +763,10 @@
# are those having memorystate NOMEMORY
return s_cto.knowntype._type_.annotator_type
except AttributeError:
+ if extregistry.is_registered_type(s_cto.knowntype._type_):
+ entry = extregistry.lookup_type(s_cto.knowntype._type_)
+ return lltype_to_annotation(entry.lowleveltype)
+
return SomeCTypesObject(
s_cto.knowntype._type_,
memorystate=s_cto.memorystate)
Modified: pypy/dist/pypy/rpython/rctypes/rarray.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/rarray.py (original)
+++ pypy/dist/pypy/rpython/rctypes/rarray.py Thu Mar 2 19:25:37 2006
@@ -56,8 +56,7 @@
def arraytype_compute_annotation(metatype, type):
def compute_result_annotation(*arg_s):
return SomeCTypesObject(type, SomeCTypesObject.OWNSMEMORY)
- return SomeBuiltin(compute_result_annotation,
- methodname=type.__name__)
+ return SomeBuiltin(compute_result_annotation, methodname=type.__name__)
extregistry.register_type(ArrayType,
compute_annotation=arraytype_compute_annotation,
Modified: pypy/dist/pypy/rpython/rctypes/test/test_rarray.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/test/test_rarray.py (original)
+++ pypy/dist/pypy/rpython/rctypes/test/test_rarray.py Thu Mar 2 19:25:37 2006
@@ -19,7 +19,7 @@
c_int_10 = ARRAY(c_int,10)
c_int_p_test = POINTER(c_int)
-py.test.skip("Reworking primitive types")
+#py.test.skip("Reworking primitive types")
class Test_annotation:
def test_annotate_array(self):
@@ -49,7 +49,7 @@
if conftest.option.view:
t.view()
- def test_annotate_pointer_access_as_array(self):
+ def x_test_annotate_pointer_access_as_array(self):
"""
Make sure that pointers work the same way as arrays, for
ctypes compatibility.
@@ -74,7 +74,7 @@
assert s.knowntype == int
#d#t.view()
- def test_annotate_array_slice_access(self):
+ def x_test_annotate_array_slice_access(self):
def slice_access():
my_array = c_int_10()
#f#my_array[0:7] = c_int(1) * 7
@@ -127,7 +127,7 @@
py.test.raises(IndexError, "s = a.build_types(access_with_invalid_negative_index,[])")
class Test_specialization:
- def test_specialize_array(self):
+ def x_test_specialize_array(self):
def create_array():
return c_int_10()
@@ -138,7 +138,7 @@
py.test.raises(IndexError, "c_data[10]")
py.test.raises(TypeError, "len(c_data)")
- def test_specialize_array_access(self):
+ def x_test_specialize_array_access(self):
def access_array():
my_array = c_int_10()
my_array[0] = 1
More information about the Pypy-commit
mailing list