if not getattr(TLS, 'no_side_effects_in_union', 0): bookkeeper = getbookkeeper() if bookkeeper is not None: bookkeeper.ondegenerated('union', s_value) return s_value # XXX unify this with ObjSpace.MethodTable BINARY_OPERATIONS = set(['add', 'sub', 'mul', 'div', 'mod', 'truediv', 'floordiv', 'divmod', 'pow', 'and_', 'or_', 'xor', 'lshift', 'rshift', 'getitem', 'setitem', 'delitem', 'getitem_idx', 'getitem_key', 'getitem_idx_key', 'inplace_add', 'inplace_sub', 'inplace_mul', 'inplace_truediv', 'inplace_floordiv', 'inplace_div', 'inplace_mod', 'inplace_pow', 'inplace_lshift', 'inplace_rshift', 'inplace_and', 'inplace_or', 'inplace_xor', 'lt', 'le', 'eq', 'ne', 'gt', 'ge', 'is_', 'cmp', 'coerce', ] +[opname+'_ovf' for opname in """add sub mul floordiv div mod pow lshift """.split() ]) for opname in BINARY_OPERATIONS: missing_operation(pairtype(SomeObject, SomeObject), opname) class __extend__(pairtype(SomeObject, SomeObject)): def union((obj1, obj2)):
UNARY_OPERATIONS = set( [ "len", "is_true", "getattr", "setattr", "delattr", "simple_call", "call_args", "str", "repr", "iter", "next", "invert", "type", "issubtype", "pos", "neg", "nonzero", "abs", "hex", "oct", "ord", "int", "float", "long", "hash", "id", # <== not supported any more "getslice", "setslice", "delslice", "neg_ovf", "abs_ovf", "hint", "unicode", "unichr", ] )
unionof, set, missing_operation, add_knowntypedata, HarmlesslyBlocked, \ SomeGenericCallable, SomeWeakRef, SomeUnicodeString from pypy.annotation.bookkeeper import getbookkeeper from pypy.annotation import builtin from pypy.annotation.binaryop import _clone ## XXX where to put this? from pypy.rpython import extregistry # convenience only! def immutablevalue(x): return getbookkeeper().immutablevalue(x) UNARY_OPERATIONS = set([ 'len', 'is_true', 'getattr', 'setattr', 'delattr', 'hash', 'simple_call', 'call_args', 'str', 'repr', 'iter', 'next', 'invert', 'type', 'issubtype', 'pos', 'neg', 'nonzero', 'abs', 'hex', 'oct', 'ord', 'int', 'float', 'long', 'id', 'neg_ovf', 'abs_ovf', 'hint', 'unicode', 'unichr' ]) for opname in UNARY_OPERATIONS: missing_operation(SomeObject, opname) class __extend__(SomeObject): def type(obj, *moreargs): if moreargs: raise Exception, 'type() called with more than one argument' if obj.is_constant(): if isinstance(obj, SomeInstance): r = SomePBC([obj.classdef.classdesc]) else:
SomeCTypesObject, s_ImpossibleValue, s_Bool, \ unionof, set, missing_operation, add_knowntypedata, HarmlesslyBlocked, \ SomeGenericCallable from pypy.annotation.bookkeeper import getbookkeeper from pypy.annotation import builtin from pypy.annotation.binaryop import _clone ## XXX where to put this? from pypy.rpython import extregistry from pypy.annotation.signature import annotation # convenience only! def immutablevalue(x): return getbookkeeper().immutablevalue(x) UNARY_OPERATIONS = set(['len', 'is_true', 'getattr', 'setattr', 'delattr', 'hash', 'simple_call', 'call_args', 'str', 'repr', 'iter', 'next', 'invert', 'type', 'issubtype', 'pos', 'neg', 'nonzero', 'abs', 'hex', 'oct', 'ord', 'int', 'float', 'long', 'id', 'neg_ovf', 'abs_ovf', 'hint']) for opname in UNARY_OPERATIONS: missing_operation(SomeObject, opname) class __extend__(SomeObject): def type(obj, *moreargs): if moreargs: raise Exception, 'type() called with more than one argument' if obj.is_constant(): if isinstance(obj, SomeInstance): r = SomePBC([obj.classdef.classdesc])
BINARY_OPERATIONS = set([ 'add', 'sub', 'mul', 'div', 'mod', 'truediv', 'floordiv', 'divmod', 'pow', 'and_', 'or_', 'xor', 'lshift', 'rshift', 'getitem', 'setitem', 'delitem', 'getitem_idx', 'getitem_key', 'getitem_idx_key', 'inplace_add', 'inplace_sub', 'inplace_mul', 'inplace_truediv', 'inplace_floordiv', 'inplace_div', 'inplace_mod', 'inplace_pow', 'inplace_lshift', 'inplace_rshift', 'inplace_and', 'inplace_or', 'inplace_xor', 'lt', 'le', 'eq', 'ne', 'gt', 'ge', 'is_', 'cmp', 'coerce', ] + [ opname + '_ovf' for opname in """add sub mul floordiv div mod pow lshift """.split() ])
s_ImpossibleValue, s_Bool, s_None, \ unionof, set, missing_operation, add_knowntypedata, HarmlesslyBlocked, \ SomeGenericCallable, SomeWeakRef, SomeUnicodeString from pypy.annotation.bookkeeper import getbookkeeper from pypy.annotation import builtin from pypy.annotation.binaryop import _clone ## XXX where to put this? from pypy.rpython import extregistry # convenience only! def immutablevalue(x): return getbookkeeper().immutablevalue(x) UNARY_OPERATIONS = set(['len', 'is_true', 'getattr', 'setattr', 'delattr', 'simple_call', 'call_args', 'str', 'repr', 'iter', 'next', 'invert', 'type', 'issubtype', 'pos', 'neg', 'nonzero', 'abs', 'hex', 'oct', 'ord', 'int', 'float', 'long', 'hash', 'id', # <== not supported any more 'getslice', 'setslice', 'delslice', 'neg_ovf', 'abs_ovf', 'hint', 'unicode', 'unichr']) for opname in UNARY_OPERATIONS: missing_operation(SomeObject, opname) class __extend__(SomeObject): def type(obj, *moreargs): if moreargs: raise Exception, 'type() called with more than one argument' if obj.is_constant(): if isinstance(obj, SomeInstance):