[pypy-svn] r37004 - pypy/dist/pypy/rpython

pedronis at codespeak.net pedronis at codespeak.net
Fri Jan 19 16:33:07 CET 2007


Author: pedronis
Date: Fri Jan 19 16:32:56 2007
New Revision: 37004

Modified:
   pypy/dist/pypy/rpython/annlowlevel.py
Log:
(arre, pedronis) this fix an rtyping problem that can occur depending on annotation order of the usages of the helpers
cast_object_to_ptr, cast_instance_to_base_ptr.



Modified: pypy/dist/pypy/rpython/annlowlevel.py
==============================================================================
--- pypy/dist/pypy/rpython/annlowlevel.py	(original)
+++ pypy/dist/pypy/rpython/annlowlevel.py	Fri Jan 19 16:32:56 2007
@@ -383,11 +383,15 @@
         return annmodel.SomePtr(s_PTR.const)
 
     def specialize_call(self, hop):
+        from pypy.rpython import rpbc
+        PTR = hop.r_result.lowleveltype
+        if isinstance(hop.args_r[1], rpbc.NoneFrozenPBCRepr):
+            return hop.inputconst(PTR, lltype.nullptr(PTR.TO))
         v_arg = hop.inputarg(hop.args_r[1], arg=1)
         assert isinstance(v_arg.concretetype, lltype.Ptr)
         hop.exception_cannot_occur()
         return hop.genop('cast_pointer', [v_arg],
-                         resulttype = hop.r_result.lowleveltype)
+                         resulttype = PTR)
 
 # ____________________________________________________________
 



More information about the Pypy-commit mailing list