Author: mattip <[email protected]>
Branch: py3k
Changeset: r56078:00e7cf3b337e
Date: 2012-07-14 23:05 +1000
http://bitbucket.org/pypy/pypy/changeset/00e7cf3b337e/
Log: back out latest changesets, retain python2.x syntax
diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -1,4 +1,3 @@
-from __future__ import print_function
import py, pytest, sys, os, textwrap, types
from pypy.interpreter.gateway import app2interp_temp
from pypy.interpreter.error import OperationError
@@ -103,7 +102,7 @@
config = make_config(option)
try:
space = make_objspace(config)
- except OperationError as e:
+ except OperationError, e:
check_keyboard_interrupt(e)
if option.verbose:
import traceback
@@ -157,7 +156,7 @@
assert body.startswith('(')
src = py.code.Source("def anonymous" + body)
d = {}
- exec(src.compile() in d)
+ exec src.compile() in d
return d['anonymous'](*args)
def wrap(self, obj):
@@ -236,9 +235,9 @@
pyfile.write(helpers + str(source))
res, stdout, stderr = runsubprocess.run_subprocess(
python, [str(pyfile)])
- print(source)
- print(stdout, file=sys.stdout)
- print(stderr, file=sys.stderr)
+ print source
+ print >> sys.stdout, stdout
+ print >> sys.stderr, stderr
if res > 0:
raise AssertionError("Subprocess failed")
@@ -251,7 +250,7 @@
try:
if e.w_type.name == 'KeyboardInterrupt':
tb = sys.exc_info()[2]
- raise OpErrKeyboardInterrupt(OpErrKeyboardInterrupt(), tb)
+ raise OpErrKeyboardInterrupt, OpErrKeyboardInterrupt(), tb
except AttributeError:
pass
@@ -413,10 +412,10 @@
def runtest(self):
try:
super(IntTestFunction, self).runtest()
- except OperationError as e:
+ except OperationError, e:
check_keyboard_interrupt(e)
raise
- except Exception as e:
+ except Exception, e:
cls = e.__class__
while cls is not Exception:
if cls.__name__ == 'DistutilsPlatformError':
@@ -437,13 +436,13 @@
def execute_appex(self, space, target, *args):
try:
target(*args)
- except OperationError as e:
+ except OperationError, e:
tb = sys.exc_info()[2]
if e.match(space, space.w_KeyboardInterrupt):
- raise OpErrKeyboardInterrupt(OpErrKeyboardInterrupt(), tb)
+ raise OpErrKeyboardInterrupt, OpErrKeyboardInterrupt(), tb
appexcinfo = appsupport.AppExceptionInfo(space, e)
if appexcinfo.traceback:
- raise AppError(AppError(appexcinfo), tb)
+ raise AppError, AppError(appexcinfo), tb
raise
def runtest(self):
@@ -454,7 +453,7 @@
space = gettestobjspace()
filename = self._getdynfilename(target)
func = app2interp_temp(src, filename=filename)
- print("executing", func)
+ print "executing", func
self.execute_appex(space, func, space)
def repr_failure(self, excinfo):
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -108,8 +108,7 @@
self.func = original_sig.func
self.orig_arg = iter(original_sig.argnames).next
- def visit_function(self, func_cls, app_sig):
- func, cls = func_cls
+ def visit_function(self, (func, cls), app_sig):
self.dispatch(cls, app_sig)
def visit_self(self, cls, app_sig):
@@ -209,8 +208,7 @@
def scopenext(self):
return "scope_w[%d]" % self.succ()
- def visit_function(self, func_cls):
- func, cls = func_cls
+ def visit_function(self, (func, cls)):
self.run_args.append("%s(%s)" % (self.use(func),
self.scopenext()))
@@ -296,7 +294,7 @@
def _run(self, space, scope_w):
return self.behavior(%s)
\n""" % (', '.join(self.run_args),)
- exec(compile2(source) in self.miniglobals, d)
+ exec compile2(source) in self.miniglobals, d
activation_cls = type("BuiltinActivation_UwS_%s" % label,
(BuiltinActivation,), d)
@@ -322,7 +320,7 @@
def _run(self, space, scope_w):
"""Subclasses with behavior specific for an unwrap spec are
generated"""
- raise TypeError("abstract")
+ raise TypeError, "abstract"
#________________________________________________________________
@@ -348,7 +346,7 @@
self.args.append(arg)
return arg
- def visit_function(self, func_cls):
+ def visit_function(self, (func, cls)):
raise FastFuncNotSupported
def visit_self(self, typ):
@@ -436,7 +434,7 @@
\n""" % (func.__name__, narg,
', '.join(args),
', '.join(unwrap_info.unwrap))
- exec(compile2(source) in unwrap_info.miniglobals, d)
+ exec compile2(source) in unwrap_info.miniglobals, d
fastfunc = d['fastfunc_%s_%d' % (func.__name__, narg)]
return narg, fastfunc
make_fastfunc = staticmethod(make_fastfunc)
@@ -629,7 +627,7 @@
self.descrmismatch_op,
self.descr_reqcls,
args)
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -646,7 +644,7 @@
space.w_None)
except MemoryError:
raise OperationError(space.w_MemoryError, space.w_None)
- except rstackovf.StackOverflow as e:
+ except rstackovf.StackOverflow, e:
rstackovf.check_stack_overflow()
raise space.prebuilt_recursion_error
except RuntimeError: # not on top of py.py
@@ -666,7 +664,7 @@
self.descrmismatch_op,
self.descr_reqcls,
args)
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -686,7 +684,7 @@
self.descrmismatch_op,
self.descr_reqcls,
args.prepend(w_obj))
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -703,7 +701,7 @@
except DescrMismatch:
raise OperationError(space.w_SystemError,
space.wrap("unexpected DescrMismatch error"))
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -722,7 +720,7 @@
self.descrmismatch_op,
self.descr_reqcls,
Arguments(space, [w1]))
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -741,7 +739,7 @@
self.descrmismatch_op,
self.descr_reqcls,
Arguments(space, [w1, w2]))
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -760,7 +758,7 @@
self.descrmismatch_op,
self.descr_reqcls,
Arguments(space, [w1, w2, w3]))
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -780,7 +778,7 @@
self.descr_reqcls,
Arguments(space,
[w1, w2, w3, w4]))
- except Exception as e:
+ except Exception, e:
self.handle_exception(space, e)
w_result = None
if w_result is None:
@@ -814,10 +812,10 @@
self_type = f.im_class
f = f.im_func
if not isinstance(f, types.FunctionType):
- raise TypeError("function expected, got %r instead" % f)
+ raise TypeError, "function expected, got %r instead" % f
if app_name is None:
if f.func_name.startswith('app_'):
- raise ValueError("function name %r suspiciously starts "
+ raise ValueError, ("function name %r suspiciously starts "
"with 'app_'" % f.func_name)
app_name = f.func_name
diff --git a/pypy/translator/goal/app_main.py b/pypy/translator/goal/app_main.py
--- a/pypy/translator/goal/app_main.py
+++ b/pypy/translator/goal/app_main.py
@@ -472,7 +472,6 @@
# this indirection is needed to be able to import this module on python2, else
# we have a SyntaxError: unqualified exec in a nested function
def exec_(src, dic):
- print('Calling exec(%s, %s)',src,dic)
exec(src, dic)
def run_command_line(interactive,
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit