[pypy-svn] r15889 - pypy/dist/pypy/annotation
pedronis at codespeak.net
pedronis at codespeak.net
Wed Aug 10 02:43:37 CEST 2005
Author: pedronis
Date: Wed Aug 10 02:43:36 2005
New Revision: 15889
Modified:
pypy/dist/pypy/annotation/binaryop.py
pypy/dist/pypy/annotation/unaryop.py
Log:
typed iter cannot raise TypeError
no OverflowError from inplace ops
Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py (original)
+++ pypy/dist/pypy/annotation/binaryop.py Wed Aug 10 02:43:36 2005
@@ -92,6 +92,15 @@
def inplace_or((obj1, obj2)): return pair(obj1, obj2).or_()
def inplace_xor((obj1, obj2)): return pair(obj1, obj2).xor()
+ for name, func in locals().items():
+ if name.startswith('inplace_'):
+ func.can_only_throw = []
+
+ inplace_div.can_only_throw = [ZeroDivisionError]
+ inplace_truediv.can_only_throw = [ZeroDivisionError]
+ inplace_floordiv.can_only_throw = [ZeroDivisionError]
+ inplace_mod.can_only_throw = [ZeroDivisionError]
+
def lt((obj1, obj2)):
if obj1.is_constant() and obj2.is_constant():
return immutablevalue(obj1.const < obj2.const)
@@ -335,6 +344,7 @@
lst1.listdef.resize()
lst1.listdef.union(lst2.listdef)
return lst1
+ inplace_add.can_only_throw = []
def eq((lst1, lst2)):
lst1.listdef.union(lst2.listdef)
@@ -349,11 +359,12 @@
s_iter = obj2.iter()
pair(lst1, SomeInteger()).setitem(s_iter.next())
return lst1
+ inplace_add.can_only_throw = []
def inplace_mul((lst1, obj2)):
lst1.listdef.resize()
return lst1
-
+ inplace_mul.can_only_throw = []
class __extend__(pairtype(SomeTuple, SomeTuple)):
Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py (original)
+++ pypy/dist/pypy/annotation/unaryop.py Wed Aug 10 02:43:36 2005
@@ -212,6 +212,7 @@
def iter(tup):
getbookkeeper().count("tuple_iter", tup)
return SomeIterator(tup)
+ iter.can_only_throw = []
def getanyitem(tup):
return unionof(*tup.items)
@@ -254,6 +255,7 @@
def iter(lst):
return SomeIterator(lst)
+ iter.can_only_throw = []
def getanyitem(lst):
return lst.listdef.read_item()
@@ -269,6 +271,7 @@
def iter(dct):
return SomeIterator(dct)
+ iter.can_only_throw = []
def getanyitem(dct):
return dct.dictdef.read_key()
@@ -315,6 +318,7 @@
def iter(str):
return SomeIterator(str)
+ iter.can_only_throw = []
def getanyitem(str):
return SomeChar()
@@ -357,6 +361,7 @@
def iter(itr):
return itr
+ iter.can_only_throw = []
def next(itr):
return itr.s_container.getanyitem()
More information about the Pypy-commit
mailing list