'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): r = SomePBC([obj.classdef.classdesc]) else: r = immutablevalue(obj.knowntype) else: r = SomeObject() r.knowntype = type bk = getbookkeeper()
"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): r = SomePBC([obj.classdef.classdesc]) else: r = immutablevalue(obj.knowntype) else: r = SomeObject() r.knowntype = type bk = getbookkeeper()
'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)): if obj1 == obj2: return obj1 else: result = SomeObject() if obj1.knowntype == obj2.knowntype and obj1.knowntype != object: result.knowntype = obj1.knowntype is_type_of1 = getattr(obj1, 'is_type_of', None) is_type_of2 = getattr(obj2, 'is_type_of', None) if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const: result.const = obj1.const is_type_of = {}
'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)): if obj1 == obj2: return obj1 else: result = SomeObject() if obj1.knowntype == obj2.knowntype and obj1.knowntype != object: result.knowntype = obj1.knowntype is_type_of1 = getattr(obj1, 'is_type_of', None) is_type_of2 = getattr(obj2, 'is_type_of', None) if obj1.is_immutable_constant() and obj2.is_immutable_constant( ) and obj1.const == obj2.const: result.const = obj1.const