diff options
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/compiler/dumppyc.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Tools/compiler/dumppyc.py b/Tools/compiler/dumppyc.py index dd460c9..8cfe3b1 100755 --- a/Tools/compiler/dumppyc.py +++ b/Tools/compiler/dumppyc.py @@ -28,7 +28,7 @@ def walk(co, match=None): if type(obj) == types.CodeType: walk(obj, match) -def main(filename, codename=None): +def load(filename, codename=None): co = loadCode(filename) walk(co, codename) @@ -39,6 +39,9 @@ if __name__ == "__main__": else: filename = sys.argv[1] codename = None - if filename.endswith('.py') and os.path.exists(filename+"c"): - filename += "c" - main(filename, codename) + if filename.endswith('.py'): + buf = open(filename).read() + co = compile(buf, filename, "exec") + walk(co) + else: + load(filename, codename) |