Commits

Shashank Bharadwaj committed 14df2b1

formatting

  • Participants
  • Parent commits 9ea78bb

Comments (0)

Files changed (1)

File fix-asm-via-cfg.patch

 new file mode 100644
 --- /dev/null
 +++ b/src/org/python/compiler/cfg/IRBuilder.java
-@@ -0,0 +1,367 @@
+@@ -0,0 +1,378 @@
 +package org.python.compiler.cfg;
 +
 +import java.util.ArrayList;
 +        // exc = True
 +        data.stmts.add(new Assign(token, Collections.singletonList((expr) new Name(token, exc,
 +                expr_contextType.Store)), genLoadName(token, "True")));
-+        /*
-+         * try: try: VAR = value # Only if "as VAR" is present BLOCK except: #
-+         * The exceptional case is handled here exc = False if not exit(mgr,
-+         * *sys.exc_info()): raise # The exception is swallowed if exit()
-+         * returns true finally: # The normal and non-local-goto cases are
-+         * handled here if exc: exit(mgr, None, None, None)
++
++        /* From the PEP, here is the transformation we need to make.
++         *
++         * try:
++         *   try:
++         *     VAR = value  # Only if "as VAR" is present
++         *     BLOCK
++         *   except:
++         *     # The exceptional case is handled here
++         *     exc = False
++         *     if not exit(mgr, *sys.exc_info()):
++         *       raise
++         *   # The exception is swallowed if exit() returns true
++         *   finally:
++         *     # The normal and non-local-goto cases are handled here
++         *     if exc:
++         *       exit(mgr, None, None, None)
 +         */
 +        List<stmt> handler_body = new ArrayList<stmt>();
 +        handler_body.add(new Assign(token, Collections.singletonList((expr) new Name(token, exc,