From: <th...@us...> - 2008-09-25 18:52:37
|
Revision: 5347 http://jython.svn.sourceforge.net/jython/?rev=5347&view=rev Author: thobes Date: 2008-09-25 18:52:30 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Fix of the bug with "def f(): lambda x=(yield): 1". The problem was that the order of instructions were such that there was elements on the stack before the yield-point that does not get restored. I also found another problem in that the types for local variables in CodeCompiler are not proper java types, this is in error in nearly all places, and needs to be fixed in a later commit. Modified Paths: -------------- trunk/jython/src/org/python/compiler/CodeCompiler.java Modified: trunk/jython/src/org/python/compiler/CodeCompiler.java =================================================================== --- trunk/jython/src/org/python/compiler/CodeCompiler.java 2008-09-24 22:12:23 UTC (rev 5346) +++ trunk/jython/src/org/python/compiler/CodeCompiler.java 2008-09-25 18:52:30 UTC (rev 5347) @@ -331,15 +331,17 @@ if (n == 0) { code.getstatic("org/python/core/Py", "EmptyObjects", $pyObjArr); } else { - int tmp = code.getLocal("[org/python/core/PyObject"); + int tmp = code.getLocal("[Lorg/python/core/PyObject;"); code.iconst(n); code.anewarray("org/python/core/PyObject"); code.astore(tmp); for(int i=0; i<n; i++) { + visit(nodes[i]); code.aload(tmp); + code.swap(); code.iconst(i); - visit(nodes[i]); + code.swap(); code.aastore(); } code.aload(tmp); @@ -1787,16 +1789,20 @@ setline(node); + ScopeInfo scope = module.getScopeInfo(node); + + makeArray(scope.ac.getDefaults()); + code.new_("org/python/core/PyFunction"); + + code.dup_x1(); + code.swap(); - code.dup(); loadFrame(); code.getfield("org/python/core/PyFrame", "f_globals", $pyObj); + + code.swap(); - ScopeInfo scope = module.getScopeInfo(node); - - makeArray(scope.ac.getDefaults()); - scope.setup_closure(); scope.dump(); module.PyCode(retSuite, name, true, className, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |