Commits

Victor Stinner committed 9a185d1

fix demo.py for nested functions

Comments (0)

Files changed (1)

             continue
         print("")
         print("%s:" % const)
-        dis.dis(const)
+        dump_bytecode(const)
 
 def main():
     if len(sys.argv) < 2:
         print("example: %s '1+1'" % sys.argv[0])
         sys.exit(1)
     if len(sys.argv) == 2 and sys.argv[1] == '-':
-        code = sys.stdin.read()
+        code_str = sys.stdin.read()
     else:
-        code = '\n'.join(sys.argv[1:])
+        code_str = '\n'.join(sys.argv[1:])
 
     config = Config('builtin_funcs', 'pythonenv')
     print("Config features: %s" % ', '.join(sorted(config.features)))
     print("")
 
-    tree = parse_ast(code)
+    tree = parse_ast(code_str)
     print("Original AST:")
     print(ast.dump(tree))
     print("")
 
     print("Original bytecode:")
     try:
-        code = compile(code, "<string>", "exec")
+        code = compile(code_str, "<string>", "exec")
     except SyntaxError:
         print("*** SYNTAX ERROR ***")
     else: