From: <fwi...@us...> - 2008-07-24 16:58:26
|
Revision: 4996 http://jython.svn.sourceforge.net/jython/?rev=4996&view=rev Author: fwierzbicki Date: 2008-07-24 16:58:24 +0000 (Thu, 24 Jul 2008) Log Message: ----------- Fix for wrong line numbers in func.co_firstlineno. Modified Paths: -------------- branches/asm/src/org/python/compiler/CodeCompiler.java Modified: branches/asm/src/org/python/compiler/CodeCompiler.java =================================================================== --- branches/asm/src/org/python/compiler/CodeCompiler.java 2008-07-24 13:51:47 UTC (rev 4995) +++ branches/asm/src/org/python/compiler/CodeCompiler.java 2008-07-24 16:58:24 UTC (rev 4996) @@ -397,7 +397,7 @@ scope.dump(); module.PyCode(new Suite(node, node.body), name, true, className, false, false, - node.getTokenStartIndex(), scope, cflags).get(code); + node.getLine(), scope, cflags).get(code); getDocString(node.body); @@ -1738,7 +1738,7 @@ scope.setup_closure(); scope.dump(); module.PyCode(retSuite, name, true, className, - false, false, node.getTokenStartIndex(), scope, cflags).get(code); + false, false, node.getLine(), scope, cflags).get(code); if (!makeClosure(scope)) { code.invokespecial("org/python/core/PyFunction", "<init>", "(" + $pyObj + $pyObjArr + $pyCode + ")V"); @@ -1781,7 +1781,7 @@ scope.dump(); //Make code object out of suite module.PyCode(new Suite(node, node.body), name, false, name, - true, false, node.getTokenStartIndex(), scope, cflags).get(code); + true, false, node.getLine(), scope, cflags).get(code); //Get doc string (if there) getDocString(node.body); @@ -1980,7 +1980,7 @@ module.PyCode(new Suite(node, new stmtType[]{n}), tmp_append, true, className, false, false, - node.getTokenStartIndex(), scope, cflags).get(code); + node.getLine(), scope, cflags).get(code); code.aconst_null(); if (!makeClosure(scope)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2008-08-09 17:35:11
|
Revision: 5124 http://jython.svn.sourceforge.net/jython/?rev=5124&view=rev Author: fwierzbicki Date: 2008-08-09 17:35:06 +0000 (Sat, 09 Aug 2008) Log Message: ----------- Call __iter__ on the iter part of gen expressions. Modified Paths: -------------- branches/asm/src/org/python/compiler/CodeCompiler.java Modified: branches/asm/src/org/python/compiler/CodeCompiler.java =================================================================== --- branches/asm/src/org/python/compiler/CodeCompiler.java 2008-08-09 17:07:19 UTC (rev 5123) +++ branches/asm/src/org/python/compiler/CodeCompiler.java 2008-08-09 17:35:06 UTC (rev 5124) @@ -2012,6 +2012,7 @@ visit(new Name(node, tmp_append, expr_contextType.Load)); visit(iter); + code.invokevirtual("org/python/core/PyObject", "__iter__", "()Lorg/python/core/PyObject;"); code.invokevirtual("org/python/core/PyObject", "__call__", "(" + $pyObj + ")" + $pyObj); visit(new Delete(n, new exprType[] { new Name(n, tmp_append, expr_contextType.Del) })); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zy...@us...> - 2008-08-10 19:52:55
|
Revision: 5132 http://jython.svn.sourceforge.net/jython/?rev=5132&view=rev Author: zyasoft Date: 2008-08-10 19:52:51 +0000 (Sun, 10 Aug 2008) Log Message: ----------- After a more careful reading of PEP 342: need to emit bytecode for getGeneratorInput and possible raising exception before any yields; and after each yield point. This one-line change fixes test_contextlib Modified Paths: -------------- branches/asm/src/org/python/compiler/CodeCompiler.java Modified: branches/asm/src/org/python/compiler/CodeCompiler.java =================================================================== --- branches/asm/src/org/python/compiler/CodeCompiler.java 2008-08-10 15:31:52 UTC (rev 5131) +++ branches/asm/src/org/python/compiler/CodeCompiler.java 2008-08-10 19:52:51 UTC (rev 5132) @@ -552,15 +552,17 @@ throw new ParseException("'yield' outside function", node); } - loadFrame(); - code.invokevirtual("org/python/core/PyFrame", "getGeneratorInput", "()" + $obj); - code.dup(); - code.instanceof_("org/python/core/PyException"); - Label done = new Label(); - code.ifeq(done); - code.checkcast("java/lang/Throwable"); - code.athrow(); - code.label(done); + if (yield_count == 0) { + loadFrame(); + code.invokevirtual("org/python/core/PyFrame", "getGeneratorInput", "()" + $obj); + code.dup(); + code.instanceof_("org/python/core/PyException"); + Label done = new Label(); + code.ifeq(done); + code.checkcast("java/lang/Throwable"); + code.athrow(); + code.label(done); + } if (node.value != null) { visit(node.value); @@ -577,14 +579,14 @@ restoreLocals(); loadFrame(); - code.invokevirtual("org/python/core/PyFrame", "checkGeneratorInput", "()" + $obj); + code.invokevirtual("org/python/core/PyFrame", "getGeneratorInput", "()" + $obj); code.dup(); code.instanceof_("org/python/core/PyException"); - done = new Label(); - code.ifeq(done); + Label done2 = new Label(); + code.ifeq(done2); code.checkcast("java/lang/Throwable"); code.athrow(); - code.label(done); + code.label(done2); code.checkcast("org/python/core/PyObject"); return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2008-08-11 16:43:51
|
Revision: 5150 http://jython.svn.sourceforge.net/jython/?rev=5150&view=rev Author: fwierzbicki Date: 2008-08-11 16:43:44 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Added 3 arg and 4 arg __call__ Modified Paths: -------------- branches/asm/src/org/python/compiler/CodeCompiler.java Modified: branches/asm/src/org/python/compiler/CodeCompiler.java =================================================================== --- branches/asm/src/org/python/compiler/CodeCompiler.java 2008-08-11 12:44:54 UTC (rev 5149) +++ branches/asm/src/org/python/compiler/CodeCompiler.java 2008-08-11 16:43:44 UTC (rev 5150) @@ -1444,6 +1444,19 @@ visit(values[1]); code.invokevirtual("org/python/core/PyObject", "__call__", "(" + $pyObj + $pyObj + ")" + $pyObj); break; + case 3: + visit(values[0]); + visit(values[1]); + visit(values[2]); + code.invokevirtual("org/python/core/PyObject", "__call__", "(" + $pyObj + $pyObj + $pyObj + ")" + $pyObj); + break; + case 4: + visit(values[0]); + visit(values[1]); + visit(values[2]); + visit(values[3]); + code.invokevirtual("org/python/core/PyObject", "__call__", "(" + $pyObj + $pyObj + $pyObj + $pyObj + ")" + $pyObj); + break; default: makeArray(values); code.invokevirtual("org/python/core/PyObject", "__call__", "(" + $pyObjArr + ")" + $pyObj); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |