[pypy-svn] pypy default: (arigo, fijal) cleanup warnings on SomePBC(const=None), fix translation

fijal commits-noreply at bitbucket.org
Tue Jan 18 21:21:27 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r40902:eff9071f7626
Date: 2011-01-18 22:19 +0200
http://bitbucket.org/pypy/pypy/changeset/eff9071f7626/

Log:	(arigo, fijal) cleanup warnings on SomePBC(const=None), fix
	translation hopefully

diff --git a/pypy/annotation/unaryop.py b/pypy/annotation/unaryop.py
--- a/pypy/annotation/unaryop.py
+++ b/pypy/annotation/unaryop.py
@@ -670,7 +670,8 @@
     getattr.can_only_throw = []
 
     def setattr(pbc, s_attr, s_value):
-        getbookkeeper().warning("setattr not wanted on %r" % (pbc,))
+        if not pbc.isNone():
+            raise AnnotatorError("setattr on %r" % pbc)
 
     def call(pbc, args):
         bookkeeper = getbookkeeper()

diff --git a/pypy/annotation/binaryop.py b/pypy/annotation/binaryop.py
--- a/pypy/annotation/binaryop.py
+++ b/pypy/annotation/binaryop.py
@@ -23,6 +23,7 @@
 from pypy.annotation.bookkeeper import getbookkeeper
 from pypy.objspace.flow.model import Variable, Constant
 from pypy.rlib import rarithmetic
+from pypy.tool.error import AnnotatorError
 
 # convenience only!
 def immutablevalue(x):
@@ -819,8 +820,14 @@
 
 class __extend__(pairtype(SomePBC, SomeObject)):
     def getitem((pbc, o)):
+        if not pbc.isNone():
+            raise AnnotatorError("getitem on %r" % pbc)
         return s_ImpossibleValue
 
+    def setitem((pbc, o, s_v)):
+        if not pbc.isNone():
+            raise AnnotatorError("setitem on %r" % pbc)
+
 class __extend__(pairtype(SomeExternalObject, SomeExternalObject)):
     def union((ext1, ext2)):
         if ext1.knowntype == ext2.knowntype:


More information about the Pypy-commit mailing list