[pypy-commit] pypy exception-cannot-occur: A bunch more.
arigo
noreply at buildbot.pypy.org
Sun Apr 1 20:08:53 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: exception-cannot-occur
Changeset: r54127:83e14fbf623c
Date: 2012-04-01 19:31 +0200
http://bitbucket.org/pypy/pypy/changeset/83e14fbf623c/
Log: A bunch more.
diff --git a/pypy/rlib/objectmodel.py b/pypy/rlib/objectmodel.py
--- a/pypy/rlib/objectmodel.py
+++ b/pypy/rlib/objectmodel.py
@@ -419,6 +419,7 @@
from pypy.rpython.error import TyperError
raise TyperError("compute_identity_hash() cannot be applied to"
" %r" % (vobj.concretetype,))
+ hop.exception_cannot_occur()
return hop.genop('gc_identityhash', [vobj], resulttype=lltype.Signed)
class Entry(ExtRegistryEntry):
@@ -441,6 +442,7 @@
from pypy.rpython.error import TyperError
raise TyperError("compute_unique_id() cannot be applied to"
" %r" % (vobj.concretetype,))
+ hop.exception_cannot_occur()
return hop.genop('gc_id', [vobj], resulttype=lltype.Signed)
class Entry(ExtRegistryEntry):
@@ -452,6 +454,7 @@
def specialize_call(self, hop):
vobj, = hop.inputargs(hop.args_r[0])
+ hop.exception_cannot_occur()
if hop.rtyper.type_system.name == 'lltypesystem':
from pypy.rpython.lltypesystem import lltype
if isinstance(vobj.concretetype, lltype.Ptr):
diff --git a/pypy/rpython/lltypesystem/rbuiltin.py b/pypy/rpython/lltypesystem/rbuiltin.py
--- a/pypy/rpython/lltypesystem/rbuiltin.py
+++ b/pypy/rpython/lltypesystem/rbuiltin.py
@@ -34,6 +34,7 @@
return my_instantiate()
def rtype_instantiate(hop):
+ hop.exception_cannot_occur()
s_class = hop.args_s[0]
assert isinstance(s_class, annmodel.SomePBC)
if len(s_class.descriptions) != 1:
@@ -47,6 +48,7 @@
return rclass.rtype_new_instance(hop.rtyper, classdef, hop.llops)
def rtype_builtin_hasattr(hop):
+ hop.exception_cannot_occur()
if hop.s_result.is_constant():
return hop.inputconst(lltype.Bool, hop.s_result.const)
if hop.args_r[0] == pyobj_repr:
@@ -57,6 +59,7 @@
raise TyperError("hasattr is only suported on a constant or on PyObject")
def rtype_builtin___import__(hop):
+ xxx # should not be used any more
args_v = hop.inputargs(*[pyobj_repr for ign in hop.args_r])
c = hop.inputconst(pyobj_repr, __import__)
return hop.genop('simple_call', [c] + args_v, resulttype = pyobj_repr)
diff --git a/pypy/rpython/ootypesystem/ooregistry.py b/pypy/rpython/ootypesystem/ooregistry.py
--- a/pypy/rpython/ootypesystem/ooregistry.py
+++ b/pypy/rpython/ootypesystem/ooregistry.py
@@ -22,6 +22,7 @@
annmodel.SomeOOInstance,
annmodel.SomeString))
vlist = hop.inputargs(hop.args_r[0], ootype.Signed)
+ hop.exception_cannot_occur()
return hop.genop('oostring', vlist, resulttype = ootype.String)
class Entry_oounicode(ExtRegistryEntry):
@@ -38,6 +39,7 @@
assert isinstance(hop.args_s[0], (annmodel.SomeUnicodeCodePoint,
annmodel.SomeOOInstance))
vlist = hop.inputargs(hop.args_r[0], ootype.Signed)
+ hop.exception_cannot_occur()
return hop.genop('oounicode', vlist, resulttype = ootype.Unicode)
diff --git a/pypy/rpython/rbuiltin.py b/pypy/rpython/rbuiltin.py
--- a/pypy/rpython/rbuiltin.py
+++ b/pypy/rpython/rbuiltin.py
@@ -205,6 +205,7 @@
# ____________________________________________________________
def rtype_builtin_bool(hop):
+ xxx # not called any more?
assert hop.nb_args == 1
return hop.args_r[0].rtype_is_true(hop)
@@ -451,6 +452,7 @@
assert hop.args_s[0].is_constant()
TGT = hop.args_s[0].const
v_type, v_value = hop.inputargs(lltype.Void, hop.args_r[1])
+ hop.exception_cannot_occur()
return gen_cast(hop.llops, TGT, v_value)
_cast_to_Signed = {
@@ -615,6 +617,7 @@
# non-gc objects
def rtype_free_non_gc_object(hop):
+ hop.exception_cannot_occur()
vinst, = hop.inputargs(hop.args_r[0])
flavor = hop.args_r[0].gcflavor
assert flavor != 'gc'
diff --git a/pypy/rpython/rint.py b/pypy/rpython/rint.py
--- a/pypy/rpython/rint.py
+++ b/pypy/rpython/rint.py
@@ -310,6 +310,8 @@
if hop.has_implicit_exception(ValueError):
hop.exception_is_here()
hop.gendirectcall(ll_check_chr, vlist[0])
+ else:
+ hop.exception_cannot_occur()
return hop.genop('cast_int_to_char', vlist, resulttype=Char)
def rtype_unichr(_, hop):
@@ -317,6 +319,8 @@
if hop.has_implicit_exception(ValueError):
hop.exception_is_here()
hop.gendirectcall(ll_check_unichr, vlist[0])
+ else:
+ hop.exception_cannot_occur()
return hop.genop('cast_int_to_unichar', vlist, resulttype=UniChar)
def rtype_is_true(self, hop):
More information about the pypy-commit
mailing list