[pypy-svn] rev 2232 - pypy/trunk/src/pypy/objspace/flow

arigo at codespeak.net arigo at codespeak.net
Thu Nov 20 12:56:38 CET 2003


Author: arigo
Date: Thu Nov 20 12:56:37 2003
New Revision: 2232

Modified:
   pypy/trunk/src/pypy/objspace/flow/objspace.py
Log:
Preventing calls with constant arguments to happen in advance.
And a minor optimization.


Modified: pypy/trunk/src/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/objspace.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/objspace.py	Thu Nov 20 12:56:37 2003
@@ -1,5 +1,5 @@
 # ______________________________________________________________________
-import sys, operator
+import sys, operator, types
 import pypy
 from pypy.interpreter.baseobjspace import ObjSpace, NoValue
 from pypy.interpreter.pycode import PyCode
@@ -121,9 +121,9 @@
 
     op = getattr(operator, name, None)
     if not op:
-        if name == 'call':
-            op = apply
-        elif name == 'issubtype':
+        #if name == 'call':
+        #    op = apply
+        if name == 'issubtype':
             op = issubclass
         elif name == 'id':
             op = id
@@ -134,16 +134,16 @@
 
     def generic_operator(self, *args_w):
         assert len(args_w) == arity, name+" got the wrong number of arguments"
-        args = []
-        for w_arg in args_w:
-            try:
-                arg = self.unwrap(w_arg)
-            except UnwrapException:
-                break
+        if op:
+            args = []
+            for w_arg in args_w:
+                try:
+                    arg = self.unwrap(w_arg)
+                except UnwrapException:
+                    break
+                else:
+                    args.append(arg)
             else:
-                args.append(arg)
-        else:
-            if op:
                 # All arguments are constants: call the operator now
                 #print >> sys.stderr, 'Constant operation', op
                 try:


More information about the Pypy-commit mailing list