[pypy-commit] pypy kill-someobject: (alex, arigato) fix some of the exception lgoic and remove pyobject stuff from rtuple
alex_gaynor
noreply at buildbot.pypy.org
Sun Oct 7 15:33:47 CEST 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: kill-someobject
Changeset: r57813:c5fb330531e5
Date: 2012-10-07 06:33 -0700
http://bitbucket.org/pypy/pypy/changeset/c5fb330531e5/
Log: (alex, arigato) fix some of the exception lgoic and remove pyobject
stuff from rtuple
diff --git a/pypy/rpython/llinterp.py b/pypy/rpython/llinterp.py
--- a/pypy/rpython/llinterp.py
+++ b/pypy/rpython/llinterp.py
@@ -144,13 +144,8 @@
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?")
@@ -427,7 +422,7 @@
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(
diff --git a/pypy/rpython/lltypesystem/rtuple.py b/pypy/rpython/lltypesystem/rtuple.py
--- a/pypy/rpython/lltypesystem/rtuple.py
+++ b/pypy/rpython/lltypesystem/rtuple.py
@@ -1,6 +1,5 @@
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
@@ -83,36 +82,6 @@
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
# ____________________________________________________________
#
More information about the pypy-commit
mailing list