[pypy-svn] r54720 - in pypy/dist/pypy/rpython/lltypesystem: . test

afa at codespeak.net afa at codespeak.net
Wed May 14 10:26:56 CEST 2008


Author: afa
Date: Wed May 14 10:26:55 2008
New Revision: 54720

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rffi.py
   pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
Log:
Correct the translation of rffi.make, when no fields are initialized:
exception_is_here should point to an actual llop...

Found in the win32 version of rpoll.poll().
Could not simplify the test more, though.


Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py	Wed May 14 10:26:55 2008
@@ -597,9 +597,9 @@
         vlist = [hop.inputarg(lltype.Void, arg=0)]
         flags = {'flavor':'raw'}
         vlist.append(hop.inputconst(lltype.Void, flags))
-        v_ptr = hop.genop('malloc', vlist, resulttype=hop.r_result.lowleveltype)
         hop.has_implicit_exception(MemoryError)   # record that we know about it
         hop.exception_is_here()
+        v_ptr = hop.genop('malloc', vlist, resulttype=hop.r_result.lowleveltype)
         for name, i in fields.items():
             name = name[2:]
             v_arg = hop.inputarg(hop.args_r[i], arg=i)

Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py	Wed May 14 10:26:55 2008
@@ -464,6 +464,18 @@
         res = interpret(f, [])
         assert res == 123
     
+    def test_make_annotation(self):
+        X = CStruct('xx', ('one', INT))
+        def f():
+            p = make(X)
+            try:
+                q = make(X)
+                lltype.free(q, flavor='raw')
+            finally:
+                lltype.free(p, flavor='raw')
+            return 3
+        assert interpret(f, []) == 3
+    
     def test_implicit_cast(self):
         z = llexternal('z', [USHORT, ULONG, USHORT, DOUBLE], USHORT)
     



More information about the Pypy-commit mailing list