diff options
author | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
commit | a73a964e51247ed169d322c725a3a18859f109a3 (patch) | |
tree | 3f752d117274d444bda44e85609aeac1acf313f3 /sys/src/cmd/python/Tools/compiler/stacktest.py | |
parent | e64efe273fcb921a61bf27d33b230c4e64fcd425 (diff) |
python, hg: tow outside the environment.
they've served us well, and can ride off into the sunset.
Diffstat (limited to 'sys/src/cmd/python/Tools/compiler/stacktest.py')
-rw-r--r-- | sys/src/cmd/python/Tools/compiler/stacktest.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/sys/src/cmd/python/Tools/compiler/stacktest.py b/sys/src/cmd/python/Tools/compiler/stacktest.py deleted file mode 100644 index 4f4b1611c..000000000 --- a/sys/src/cmd/python/Tools/compiler/stacktest.py +++ /dev/null @@ -1,43 +0,0 @@ -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('<lambda')): - assert a.co_name == b.co_name, (a, b) - if a.co_stacksize != b.co_stacksize: - print "stack mismatch %s: %d vs. %d" % (a.co_name, - a.co_stacksize, - b.co_stacksize) - if a.co_stacksize > 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:]) |