Commits

Alex Gaynor committed 93067e5

(alex, fijal) kill nonsense

Comments (0)

Files changed (6)

pypy/annotation/bookkeeper.py

 
         self.stats = Stats(self)
 
-        # used in SomeObject.__new__ for keeping debugging info
-        self._isomeobject_coming_from = identity_dict()
-
         delayed_imports()
 
     def count(self, category, *args):
         elif x is None:
             return s_None
         else:
-            result = SomeObject()
+            raise Exception("Don't know how to represent %r" % (x,))
         if need_const:
             result.const = x
         return result
-    
+
     def getdesc(self, pyobj):
         # get the XxxDesc wrapper for the given Python object, which must be
         # one of:

pypy/annotation/description.py

         defs_s = []
         if graph is None:
             signature = self.signature
-            defaults  = self.defaults
+            defaults = self.defaults
         else:
             signature = graph.signature
-            defaults  = graph.defaults
+            defaults = graph.defaults
         if defaults:
             for x in defaults:
-                defs_s.append(self.bookkeeper.immutablevalue(x))
+                if x is NODEFAULT:
+                    defs_s.append(None)
+                else:
+                    defs_s.append(self.bookkeeper.immutablevalue(x))
         try:
             inputcells = args.match_signature(signature, defs_s)
         except ArgErr, e:

pypy/objspace/flow/model.py

 # a discussion in Berlin, 4th of october 2003
 import py
 from pypy.tool.uid import uid, Hashable
-from pypy.tool.descriptor import roproperty
 from pypy.tool.sourcetools import PY_IDENTIFIER, nice_repr_for_func
 from pypy.rlib.rarithmetic import is_valid_int, r_longlong, r_ulonglong, r_uint
 
 
 
 class FunctionGraph(object):
-    __slots__ = ['startblock', 'returnblock', 'exceptblock', '__dict__']
-    
     def __init__(self, name, startblock, return_var=None):
         self.name        = name    # function name (possibly mangled already)
         self.startblock  = startblock
     def getreturnvar(self):
         return self.returnblock.inputargs[0]
 
-    def getsource(self):
+    @property
+    def source(self):
         from pypy.tool.sourcetools import getsource
         func = self.func    # can raise AttributeError
         src = getsource(self.func)
         if src is None:
             raise AttributeError('source not found')
         return src
-    source = roproperty(getsource)
-    
-    def getstartline(self):
+
+    @property
+    def startline(self):
         return self.func.func_code.co_firstlineno
-    startline = roproperty(getstartline)
-    
-    def getfilename(self):
+
+    @property
+    def filename(self):
         return self.func.func_code.co_filename
-    filename = roproperty(getfilename)
-    
+
     def __str__(self):
         if hasattr(self, 'func'):
             return nice_repr_for_func(self.func, self.name)

pypy/rpython/lltypesystem/lloperation.py

 """
 
 from pypy.rpython.extregistry import ExtRegistryEntry
-from pypy.tool.descriptor import roproperty
 
 
 class LLOp(object):
             val = lltype.enforce(RESULTTYPE, val)
         return val
 
-    def get_fold_impl(self):
+    @property
+    def fold(self):
+        if hasattr(self, "_fold"):
+            return self._fold
         global lltype                 #  <- lazy import hack, worth an XXX
         from pypy.rpython.lltypesystem import lltype
         if self.canrun:
             def op_impl(*args):
                 raise error
         # cache the implementation function into 'self'
-        self.fold = op_impl
+        self._fold = op_impl
         return op_impl
-    fold = roproperty(get_fold_impl)
 
     def is_pure(self, args_v):
         if self.canfold:                # canfold => pure operation

pypy/rpython/normalizecalls.py

 from pypy.rlib.objectmodel import instantiate, ComputedIntSymbolic
 from pypy.interpreter.argument import Signature
 
+
 def normalize_call_familes(annotator):
     for callfamily in annotator.bookkeeper.pbc_maximal_call_families.infos():
         if not callfamily.modified:
     call_nbargs = shape_cnt + len(shape_keys)
 
     did_something = False
-    NODEFAULT = object()
 
     for graph in graphs:
         argnames, varargname, kwargname = graph.signature
             inlist = []
             defaults = graph.defaults or ()
             num_nondefaults = len(inputargs_s) - len(defaults)
-            defaults = [NODEFAULT] * num_nondefaults + list(defaults)
+            defaults = [description.NODEFAULT] * num_nondefaults + list(defaults)
             newdefaults = []
             for j in argorder:
                 v = Variable(graph.getargs()[j])
                     v = inlist[i]
                 except ValueError:
                     default = defaults[j]
-                    if default is NODEFAULT:
+                    if default is description.NODEFAULT:
                         raise TyperError(
                             "call pattern has %d positional arguments, "
                             "but %r takes at least %d arguments" % (
             newblock.closeblock(Link(outlist, oldblock))
             graph.startblock = newblock
             for i in range(len(newdefaults)-1,-1,-1):
-                if newdefaults[i] is NODEFAULT:
+                if newdefaults[i] is description.NODEFAULT:
                     newdefaults = newdefaults[i:]
                     break
             graph.defaults = tuple(newdefaults)

pypy/tool/descriptor.py

-
-class roproperty(object):
-    def __init__(self, getter):
-        self.getter = getter
-    def __get__(self, obj, cls=None):
-        if obj is None:
-            return self
-        else:
-            return self.getter(obj)
-
-
 class InstanceMethod(object):
     "Like types.InstanceMethod, but with a reasonable (structural) equality."