diff -r ffa851df0825 -r 2fb8b9db1c86 symbian-qemu-0.9.1-12/python-2.6.1/Tools/compiler/stacktest.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/python-2.6.1/Tools/compiler/stacktest.py Fri Jul 31 15:01:17 2009 +0100 @@ -0,0 +1,43 @@ +import compiler +import dis +import types + +def extract_code_objects(co): + l = [co] + for const in co.co_consts: + if type(const) == types.CodeType: + l.append(const) + return l + +def compare(a, b): + if not (a.co_name == "?" or a.co_name.startswith(' b.co_stacksize: + print "good code" + dis.dis(a) + print "bad code" + dis.dis(b) + assert 0 + +def main(files): + for file in files: + print file + buf = open(file).read() + try: + co1 = compile(buf, file, "exec") + except SyntaxError: + print "skipped" + continue + co2 = compiler.compile(buf, file, "exec") + co1l = extract_code_objects(co1) + co2l = extract_code_objects(co2) + for a, b in zip(co1l, co2l): + compare(a, b) + +if __name__ == "__main__": + import sys + main(sys.argv[1:])