[pypy-svn] r69158 - pypy/trunk/pypy/jit/backend/test
antocuni at codespeak.net
antocuni at codespeak.net
Wed Nov 11 13:37:18 CET 2009
Author: antocuni
Date: Wed Nov 11 13:37:18 2009
New Revision: 69158
Modified:
pypy/trunk/pypy/jit/backend/test/support.py
Log:
don't crash if len(args) == 1
Modified: pypy/trunk/pypy/jit/backend/test/support.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/test/support.py (original)
+++ pypy/trunk/pypy/jit/backend/test/support.py Wed Nov 11 13:37:18 2009
@@ -31,24 +31,28 @@
if listcomp:
t.config.translation.list_comprehension_operations = True
+ arglist = ", ".join(['int(argv[%d])' % (i + 1) for i in range(len(args))])
+ if len(args) == 1:
+ arglist += ','
+ arglist = '(%s)' % arglist
if repeat != 1:
src = py.code.Source("""
def entry_point(argv):
- args = (%s,)
+ args = %s
res = function(*args)
for k in range(%d - 1):
res = function(*args)
print res
return 0
- """ % (", ".join(['int(argv[%d])' % (i + 1) for i in range(len(args))]), repeat))
+ """ % (arglist, repeat))
else:
src = py.code.Source("""
def entry_point(argv):
- args = (%s,)
+ args = %s
res = function(*args)
print res
return 0
- """ % (", ".join(['int(argv[%d])' % (i + 1) for i in range(len(args))]),))
+ """ % (arglist,))
exec src.compile() in locals()
t.buildannotator().build_types(function, [int] * len(args))
More information about the Pypy-commit
mailing list