Author: Ronan Lamy <[email protected]>
Branch: translation-cleanup
Changeset: r58221:dec7915c5171
Date: 2012-10-18 02:10 +0100
http://bitbucket.org/pypy/pypy/changeset/dec7915c5171/

Log:    copy pypy/interpreter/argument.py wholesale into flowspace

        + Use the flowspace version of ArgumentsForTranslation everywhere.

diff --git a/pypy/annotation/bookkeeper.py b/pypy/annotation/bookkeeper.py
--- a/pypy/annotation/bookkeeper.py
+++ b/pypy/annotation/bookkeeper.py
@@ -16,7 +16,7 @@
 from pypy.annotation.dictdef import DictDef
 from pypy.annotation import description
 from pypy.annotation.signature import annotationoftype
-from pypy.interpreter.argument import ArgumentsForTranslation
+from pypy.objspace.flow.argument import ArgumentsForTranslation
 from pypy.rlib.objectmodel import r_dict, Symbolic
 from pypy.tool.algo.unionfind import UnionFind
 from pypy.rpython.lltypesystem import lltype, llmemory
@@ -101,7 +101,7 @@
 
     def consider_list_delitem(self, idx):
         return self.indexrepr(idx)
-    
+
     def consider_str_join(self, s):
         if s.is_constant():
             return repr(s.const)
@@ -224,7 +224,7 @@
                 check_no_flags(s_value_or_def.listdef.listitem)
             elif isinstance(s_value_or_def, SomeDict):
                 check_no_flags(s_value_or_def.dictdef.dictkey)
-                check_no_flags(s_value_or_def.dictdef.dictvalue)               
 
+                check_no_flags(s_value_or_def.dictdef.dictvalue)
             elif isinstance(s_value_or_def, SomeTuple):
                 for s_item in s_value_or_def.items:
                     check_no_flags(s_item)
@@ -238,9 +238,9 @@
             elif isinstance(s_value_or_def, ListItem):
                 if s_value_or_def in seen:
                     return
-                seen.add(s_value_or_def)                
+                seen.add(s_value_or_def)
                 check_no_flags(s_value_or_def.s_value)
-            
+
         for clsdef in self.classdefs:
             check_no_flags(clsdef)
 
@@ -366,14 +366,14 @@
                 listdef = ListDef(self, s_ImpossibleValue)
                 for e in x:
                     listdef.generalize(self.immutablevalue(e, False))
-                result = SomeList(listdef)    
+                result = SomeList(listdef)
         elif tp is dict or tp is r_dict:
             if need_const:
                 key = Constant(x)
                 try:
                     return self.immutable_cache[key]
                 except KeyError:
-                    result = SomeDict(DictDef(self, 
+                    result = SomeDict(DictDef(self,
                                               s_ImpossibleValue,
                                               s_ImpossibleValue,
                                               is_r_dict = tp is r_dict))
@@ -396,7 +396,7 @@
                     result.const_box = key
                     return result
             else:
-                dictdef = DictDef(self, 
+                dictdef = DictDef(self,
                 s_ImpossibleValue,
                 s_ImpossibleValue,
                 is_r_dict = tp is r_dict)
@@ -545,7 +545,7 @@
             return True
         else:
             return False
-        
+
     def getfrozen(self, pyobj):
         return description.FrozenDesc(self, pyobj)
 
@@ -566,7 +566,7 @@
         key = (x.__class__, x)
         if key in self.seen_mutable:
             return
-        clsdef = self.getuniqueclassdef(x.__class__)        
+        clsdef = self.getuniqueclassdef(x.__class__)
         self.seen_mutable[key] = True
         self.event('mutable', x)
         source = InstanceSource(self, x)
@@ -586,7 +586,7 @@
         except KeyError:
             access_sets = map[attrname] = 
UnionFind(description.ClassAttrFamily)
         return access_sets
-    
+
     def pbc_getattr(self, pbc, s_attr):
         assert s_attr.is_constant()
         attr = s_attr.const
@@ -598,7 +598,7 @@
         first = descs[0]
         if len(descs) == 1:
             return first.s_read_attribute(attr)
-        
+
         change = first.mergeattrfamilies(descs[1:], attr)
         attrfamily = first.getattrfamily(attr)
 
@@ -700,7 +700,7 @@
     def ondegenerated(self, what, s_value, where=None, called_from_graph=None):
         self.annotator.ondegenerated(what, s_value, where=where,
                                      called_from_graph=called_from_graph)
-        
+
     def whereami(self):
         return self.annotator.whereami(self.position_key)
 
diff --git a/pypy/annotation/description.py b/pypy/annotation/description.py
--- a/pypy/annotation/description.py
+++ b/pypy/annotation/description.py
@@ -1,8 +1,7 @@
 import types, py
 from pypy.objspace.flow.model import Constant, FunctionGraph
-from pypy.interpreter.pycode import cpython_code_signature
-from pypy.interpreter.argument import rawshape
-from pypy.interpreter.argument import ArgErr
+from pypy.objspace.flow.bytecode import cpython_code_signature
+from pypy.objspace.flow.argument import rawshape, ArgErr
 from pypy.tool.sourcetools import valid_identifier
 from pypy.tool.pairtype import extendabletype
 
@@ -181,7 +180,7 @@
             name = pyobj.func_name
         if signature is None:
             if hasattr(pyobj, '_generator_next_method_of_'):
-                from pypy.interpreter.argument import Signature
+                from pypy.objspace.flow.argument import Signature
                 signature = Signature(['entry'])     # haaaaaack
                 defaults = ()
             else:
@@ -260,7 +259,7 @@
         try:
             inputcells = args.match_signature(signature, defs_s)
         except ArgErr, e:
-            raise TypeError("signature mismatch: %s() %s" % 
+            raise TypeError("signature mismatch: %s() %s" %
                             (self.name, e.getmsg()))
         return inputcells
 
diff --git a/pypy/interpreter/argument.py b/pypy/objspace/flow/argument.py
copy from pypy/interpreter/argument.py
copy to pypy/objspace/flow/argument.py
diff --git a/pypy/objspace/flow/bytecode.py b/pypy/objspace/flow/bytecode.py
--- a/pypy/objspace/flow/bytecode.py
+++ b/pypy/objspace/flow/bytecode.py
@@ -6,7 +6,7 @@
         HAVE_ARGUMENT)
 from pypy.interpreter.astcompiler.consts import (CO_GENERATOR, CO_VARARGS,
         CO_VARKEYWORDS)
-from pypy.interpreter.argument import Signature
+from pypy.objspace.flow.argument import Signature
 
 def cpython_code_signature(code):
     "([list-of-arg-names], vararg-name-or-None, kwarg-name-or-None)."
diff --git a/pypy/objspace/flow/flowcontext.py 
b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -8,7 +8,7 @@
 from pypy.tool.error import source_lines
 from pypy.tool.stdlib_opcode import host_bytecode_spec
 from pypy.interpreter import pyframe
-from pypy.interpreter.argument import ArgumentsForTranslation
+from pypy.objspace.flow.argument import ArgumentsForTranslation
 from pypy.interpreter.pyopcode import BytecodeCorruption
 from pypy.objspace.flow.model import (Constant, Variable, Block, Link,
     UnwrapException, c_last_exception)
diff --git a/pypy/objspace/flow/generator.py b/pypy/objspace/flow/generator.py
--- a/pypy/objspace/flow/generator.py
+++ b/pypy/objspace/flow/generator.py
@@ -6,7 +6,7 @@
 from pypy.translator.unsimplify import split_block
 from pypy.translator.simplify import eliminate_empty_blocks, simplify_graph
 from pypy.tool.sourcetools import func_with_new_name
-from pypy.interpreter.argument import Signature
+from pypy.objspace.flow.argument import Signature
 
 
 class AbstractPosition(object):
diff --git a/pypy/objspace/flow/objspace.py b/pypy/objspace/flow/objspace.py
--- a/pypy/objspace/flow/objspace.py
+++ b/pypy/objspace/flow/objspace.py
@@ -8,7 +8,7 @@
 from inspect import CO_NEWLOCALS
 
 from pypy.interpreter.baseobjspace import ObjSpace
-from pypy.interpreter.argument import ArgumentsForTranslation
+from pypy.objspace.flow.argument import ArgumentsForTranslation
 from pypy.objspace.flow.model import (Constant, Variable, WrapException,
     UnwrapException, checkgraph, SpaceOperation)
 from pypy.objspace.flow.bytecode import HostCode
diff --git a/pypy/rpython/callparse.py b/pypy/rpython/callparse.py
--- a/pypy/rpython/callparse.py
+++ b/pypy/rpython/callparse.py
@@ -1,4 +1,4 @@
-from pypy.interpreter.argument import ArgumentsForTranslation, ArgErr
+from pypy.objspace.flow.argument import ArgumentsForTranslation, ArgErr
 from pypy.annotation import model as annmodel
 from pypy.rpython import rtuple
 from pypy.rpython.error import TyperError
diff --git a/pypy/rpython/rbuiltin.py b/pypy/rpython/rbuiltin.py
--- a/pypy/rpython/rbuiltin.py
+++ b/pypy/rpython/rbuiltin.py
@@ -44,7 +44,7 @@
 
 def call_args_expand(hop, takes_kwds = True):
     hop = hop.copy()
-    from pypy.interpreter.argument import ArgumentsForTranslation
+    from pypy.objspace.flow.argument import ArgumentsForTranslation
     arguments = ArgumentsForTranslation.fromshape(
             None, hop.args_s[1].const, # shape
             range(hop.nb_args-2))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to