[pypy-svn] r10599 - pypy/dist/pypy/translator/test
tismer at codespeak.net
tismer at codespeak.net
Thu Apr 14 01:51:36 CEST 2005
Author: tismer
Date: Thu Apr 14 01:51:36 2005
New Revision: 10599
Modified:
pypy/dist/pypy/translator/test/rpystone.py
Log:
disabled the startup code which would use sys.argv.
There are quite large bugs in flow-space like this!!!
the sys module is treated very very wrong, and we really need to
heal this.
Modified: pypy/dist/pypy/translator/test/rpystone.py
==============================================================================
--- pypy/dist/pypy/translator/test/rpystone.py (original)
+++ pypy/dist/pypy/translator/test/rpystone.py Thu Apr 14 01:51:36 2005
@@ -259,6 +259,13 @@
if EnumLoc == Ident3: return TRUE
return FALSE
+# XXX the following creates bad code
+# sys.argv is seen as a constant.
+# also, in entrypoint(), the try..except is
+# removed, which is a bug.
+# XXX repair this, write a test
+
+"""
def error(msg):
#print >>sys.stderr, msg,
sys.stderr.write(msg+" ")
@@ -281,6 +288,30 @@
#else:
# loops = LOOPS
main(loops)
+"""
if __name__ == '__main__':
- entrypoint()
+ # the following should be replaced by
+ # entrypoint()
+ # for now, we use main in the test.
+
+ def error(msg):
+ #print >>sys.stderr, msg,
+ sys.stderr.write(msg+" ")
+ #print >>sys.stderr, "usage: %s [number_of_loops]" % sys.argv[0]
+ sys.stderr.write("usage: %s [number_of_loops]\n" % sys.argv[0])
+ sys.exit(100)
+ nargs = len(sys.argv) - 1
+ if nargs > 1:
+ error("%d arguments are too many;" % nargs)
+ elif nargs == 1:
+ try: loops = int(sys.argv[1])
+ except ValueError:
+ error("Invalid argument %r;" % sys.argv[1])
+ else:
+ if hasattr(sys, 'pypy_objspaceclass'):
+ loops = LOOPS / 2000 # XXX rough estimate, adjust
+ else:
+ loops = LOOPS
+ main(loops)
+
More information about the Pypy-commit
mailing list