Commits

Alex Gaynor committed c5fb330

(alex, arigato) fix some of the exception lgoic and remove pyobject stuff from rtuple

  • Participants
  • Parent commits d3601d9
  • Branches kill-someobject

Comments (0)

Files changed (2)

pypy/rpython/llinterp.py

     def find_exception(self, exc):
         assert isinstance(exc, LLException)
         klass, inst = exc.args[0], exc.args[1]
-        exdata = self.typer.getexceptiondata()
-        frame = self.frame_class(None, [], self)
         for cls in enumerate_exceptions_top_down():
-            evalue = frame.op_direct_call(exdata.fn_pyexcclass2exc,
-                    lltype.pyobjectptr(cls))
-            etype = frame.op_direct_call(exdata.fn_type_of_exc_inst, evalue)
-            if etype == klass:
+            if "".join(klass.name).rstrip("\0") == cls.__name__:
                 return cls
         raise ValueError("couldn't match exception, maybe it"
                       " has RPython attributes like OSError?")
                 if exc_data:
                     etype = e.args[0]
                     evalue = e.args[1]
-                    exc_data.exc_type  = etype
+                    exc_data.exc_type = etype
                     exc_data.exc_value = evalue
                     from pypy.translator import exceptiontransform
                     retval = exceptiontransform.error_value(

pypy/rpython/lltypesystem/rtuple.py

 from pypy.tool.pairtype import pairtype
 from pypy.rpython.rmodel import inputconst
-from pypy.rpython.robject import PyObjRepr, pyobj_repr
 from pypy.rpython.rtuple import AbstractTupleRepr, AbstractTupleIteratorRepr
 from pypy.rpython.lltypesystem.lltype import \
      Ptr, GcStruct, Void, Signed, malloc, typeOf, nullptr
 
 def dum_empty_tuple(): pass
 
-#
-# _________________________ Conversions _________________________
-
-class __extend__(pairtype(PyObjRepr, TupleRepr)):
-    def convert_from_to((r_from, r_to), v, llops):
-        vlist = []
-        for i in range(len(r_to.items_r)):
-            ci = inputconst(Signed, i)
-            v_item = llops.gencapicall('PyTuple_GetItem_WithIncref', [v, ci],
-                                       resulttype = pyobj_repr)
-            v_converted = llops.convertvar(v_item, pyobj_repr,
-                                           r_to.items_r[i])
-            vlist.append(v_converted)
-        return r_to.newtuple(llops, r_to, vlist)
-
-class __extend__(pairtype(TupleRepr, PyObjRepr)):
-    def convert_from_to((r_from, r_to), v, llops):
-        ci = inputconst(Signed, len(r_from.items_r))
-        v_result = llops.gencapicall('PyTuple_New', [ci],
-                                     resulttype = pyobj_repr)
-        for i in range(len(r_from.items_r)):
-            cname = inputconst(Void, r_from.fieldnames[i])
-            v_item = llops.genop('getfield', [v, cname],
-                                 resulttype = r_from.external_items_r[i].lowleveltype)
-            v_converted = llops.convertvar(v_item, r_from.external_items_r[i],
-                                           pyobj_repr)
-            ci = inputconst(Signed, i)
-            llops.gencapicall('PyTuple_SetItem_WithIncref', [v_result, ci,
-                                                             v_converted])
-        return v_result
 
 # ____________________________________________________________
 #