Author: Ronan Lamy <[email protected]>
Branch: annotator
Changeset: r68731:0ae89c5687bb
Date: 2013-12-14 20:22 +0100
http://bitbucket.org/pypy/pypy/changeset/0ae89c5687bb/
Log: Implement the fallbacks explicitly in unaryop.py and binaryop.py
diff --git a/rpython/annotator/unaryop.py b/rpython/annotator/unaryop.py
--- a/rpython/annotator/unaryop.py
+++ b/rpython/annotator/unaryop.py
@@ -131,6 +131,9 @@
raise AnnotatorError("Cannot find attribute %r on %r" % (attr, self))
getattr.can_only_throw = []
+ def setattr(self, *args):
+ return s_ImpossibleValue
+
def bind_callables_under(self, classdef, name):
return self # default unbound __get__ implementation
@@ -150,6 +153,20 @@
def hint(self, *args_s):
return self
+ def getslice(self, *args):
+ return s_ImpossibleValue
+
+ def setslice(self, *args):
+ return s_ImpossibleValue
+
+ def delslice(self, *args):
+ return s_ImpossibleValue
+
+ def pos(self):
+ return s_ImpossibleValue
+ neg = abs = ord = invert = long = iter = next = pos
+
+
class __extend__(SomeFloat):
def pos(self):
diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -14,7 +14,7 @@
from rpython.flowspace.model import (Constant, WrapException, const, Variable,
SpaceOperation)
from rpython.flowspace.specialcase import register_flow_sc
-from rpython.annotator.model import s_ImpossibleValue
+
NOT_REALLY_CONST = {
Constant(sys): {
@@ -137,19 +137,13 @@
class SingleDispatchMixin(object):
dispatch = 1
def consider(self, annotator, arg, *other_args):
- try:
- impl = getattr(arg, self.opname)
- except AttributeError:
- return s_ImpossibleValue
+ impl = getattr(arg, self.opname)
return impl(*other_args)
class DoubleDispatchMixin(object):
dispatch = 2
def consider(self, annotator, arg1, arg2, *other_args):
- try:
- impl = getattr(pair(arg1, arg2), self.opname)
- except AttributeError:
- return s_ImpossibleValue
+ impl = getattr(pair(arg1, arg2), self.opname)
return impl(*other_args)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit