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

arigo at codespeak.net arigo at codespeak.net
Thu Aug 25 15:15:19 CEST 2005


Author: arigo
Date: Thu Aug 25 15:15:17 2005
New Revision: 16490

Modified:
   pypy/dist/pypy/rpython/rconstantdict.py
   pypy/dist/pypy/rpython/rdict.py
   pypy/dist/pypy/rpython/rlist.py
   pypy/dist/pypy/rpython/rstr.py
Log:
Each rtype_method_*() is called by a 'simple_call' operation.  This means that
we need to declare the possible exceptions, or (as is often the case) that the
method doesn't raise an exception.


Modified: pypy/dist/pypy/rpython/rconstantdict.py
==============================================================================
--- pypy/dist/pypy/rpython/rconstantdict.py	(original)
+++ pypy/dist/pypy/rpython/rconstantdict.py	Thu Aug 25 15:15:17 2005
@@ -90,6 +90,7 @@
                                                  self.value_repr)
         hashcompute = self.get_key_hash_function()
         chashcompute = hop.inputconst(lltype.Void, hashcompute)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_constantdict_get, v_dict, v_key, v_default,
                                  chashcompute)
 

Modified: pypy/dist/pypy/rpython/rdict.py
==============================================================================
--- pypy/dist/pypy/rpython/rdict.py	(original)
+++ pypy/dist/pypy/rpython/rdict.py	Thu Aug 25 15:15:17 2005
@@ -111,14 +111,17 @@
     def rtype_method_get(self, hop):
         v_dict, v_key, v_default = hop.inputargs(self, rstr.string_repr,
                                                  self.value_repr)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_get, v_dict, v_key, v_default)
 
     def rtype_method_copy(self, hop):
         v_dict, = hop.inputargs(self)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_copy, v_dict)
 
     def rtype_method_update(self, hop):
         v_dic1, v_dic2 = hop.inputargs(self, self)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_update, v_dic1, v_dic2)
 
     def _rtype_method_kvi(self, hop, spec):
@@ -126,6 +129,7 @@
         r_list = hop.r_result
         v_func = hop.inputconst(lltype.Void, spec)
         c1 = hop.inputconst(lltype.Void, r_list.lowleveltype)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_kvi, v_dic, c1, v_func)
 
     def rtype_method_keys(self, hop):

Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Thu Aug 25 15:15:17 2005
@@ -123,14 +123,17 @@
             llfn = ll_insert_nonneg
         else:
             llfn = ll_insert
+        hop.exception_cannot_occur()
         hop.gendirectcall(llfn, *args)
 
     def rtype_method_extend(self, hop):
         v_lst1, v_lst2 = hop.inputargs(self, self)
+        hop.exception_cannot_occur()
         hop.gendirectcall(ll_extend, v_lst1, v_lst2)
     
     def rtype_method_reverse(self, hop):
         v_lst, = hop.inputargs(self)
+        hop.exception_cannot_occur()
         hop.gendirectcall(ll_reverse,v_lst)
 
     def rtype_method_pop(self, hop):
@@ -148,6 +151,7 @@
         else:
             args = hop.inputargs(self)
             llfn = ll_pop_default
+        hop.exception_cannot_occur()   # no IndexError support (yet?)
         return hop.gendirectcall(llfn, *args)
 
     def make_iterator_repr(self):

Modified: pypy/dist/pypy/rpython/rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/rstr.py	(original)
+++ pypy/dist/pypy/rpython/rstr.py	Thu Aug 25 15:15:17 2005
@@ -101,10 +101,12 @@
 
     def rtype_method_startswith(_, hop):
         v_str, v_value = hop.inputargs(string_repr, string_repr)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_startswith, v_str, v_value)
 
     def rtype_method_endswith(_, hop):
         v_str, v_value = hop.inputargs(string_repr, string_repr)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_endswith, v_str, v_value)
 
     def rtype_method_find(_, hop, reverse=False):
@@ -126,6 +128,7 @@
             llfn = ll_rfind
         else:
             llfn = ll_find
+        hop.exception_cannot_occur()
         return hop.gendirectcall(llfn, v_str, v_value, v_start, v_end)
 
     def rtype_method_rfind(self, hop):
@@ -133,13 +136,16 @@
 
     def rtype_method_upper(_, hop):
         v_str, = hop.inputargs(string_repr)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_upper, v_str)
         
     def rtype_method_lower(_, hop):
         v_str, = hop.inputargs(string_repr)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_lower, v_str)
         
     def rtype_method_join(_, hop):
+        hop.exception_cannot_occur()
         if hop.s_result.is_constant():
             return inputconst(string_repr, hop.s_result.const)
         r_lst = hop.args_r[1]
@@ -168,12 +174,14 @@
     def rtype_method_split(_, hop):
         v_str, v_chr = hop.inputargs(string_repr, char_repr)
         c = hop.inputconst(Void, hop.r_result.lowleveltype)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_split_chr, c, v_str, v_chr)
 
     def rtype_method_replace(_, hop):
         if not (hop.args_r[1] == char_repr and hop.args_r[2] == char_repr):
             raise TyperError, 'replace only works for char args'
         v_str, v_c1, v_c2 = hop.inputargs(string_repr, char_repr, char_repr)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_replace_chr_chr, v_str, v_c1, v_c2)
 
     def rtype_int(_, hop):
@@ -394,6 +402,7 @@
 
     def rtype_method_isspace(_, hop):
         vlist = hop.inputargs(char_repr)
+        hop.exception_cannot_occur()
         return hop.gendirectcall(ll_char_isspace, vlist[0])
 
 class __extend__(pairtype(CharRepr, IntegerRepr)):



More information about the Pypy-commit mailing list