[pypy-svn] r10192 - in pypy/dist/pypy: interpreter objspace/flow objspace/flow/test

pedronis at codespeak.net pedronis at codespeak.net
Thu Mar 31 00:04:57 CEST 2005


Author: pedronis
Date: Thu Mar 31 00:04:57 2005
New Revision: 10192

Modified:
   pypy/dist/pypy/interpreter/executioncontext.py
   pypy/dist/pypy/objspace/flow/objspace.py
   pypy/dist/pypy/objspace/flow/test/test_objspace.py
Log:
use builtin pow for const pow computations, operator.pow does not accept 3 args



Modified: pypy/dist/pypy/interpreter/executioncontext.py
==============================================================================
--- pypy/dist/pypy/interpreter/executioncontext.py	(original)
+++ pypy/dist/pypy/interpreter/executioncontext.py	Thu Mar 31 00:04:57 2005
@@ -107,7 +107,7 @@
 
     def exception_trace(self, frame, operationerr):
         "Trace function called upon OperationError."
-        operationerr.record_interpreter_traceback()
+        #operationerr.record_interpreter_traceback()
         exc_info = self.sys_exc_info()
         self._trace(frame, 'exception',
                     exc_info)

Modified: pypy/dist/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/objspace.py	(original)
+++ pypy/dist/pypy/objspace/flow/objspace.py	Thu Mar 31 00:04:57 2005
@@ -462,7 +462,10 @@
     if hasattr(FlowObjSpace, name):
         return # Shouldn't do it
 
-    op = getattr(operator, name, None)
+    if name == 'pow':
+        op = pow
+    else:
+        op = getattr(operator, name, None)
     if not op:
         #if name == 'call':
         #    op = apply

Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/test/test_objspace.py	(original)
+++ pypy/dist/pypy/objspace/flow/test/test_objspace.py	Thu Mar 31 00:04:57 2005
@@ -203,6 +203,14 @@
         self.show(x)
 
     #__________________________________________________________
+    def const_pow():
+        return 2 ** 5
+
+    def test_const_pow(self):
+        x = self.codetest(self.const_pow)
+        self.show(x)
+
+    #__________________________________________________________
     def implicitIndexError(lst):
         try:
             x = lst[5]



More information about the Pypy-commit mailing list