From: <fwi...@us...> - 2008-08-15 18:37:17
|
Revision: 5180 http://jython.svn.sourceforge.net/jython/?rev=5180&view=rev Author: fwierzbicki Date: 2008-08-15 18:37:14 +0000 (Fri, 15 Aug 2008) Log Message: ----------- don't allow assignment to yields. Fixes 2 doctests in test_generator as long as we ignore the exact error message. Modified Paths: -------------- branches/asm/Lib/test/test_generators.py branches/asm/src/org/python/antlr/GrammarActions.java Modified: branches/asm/Lib/test/test_generators.py =================================================================== --- branches/asm/Lib/test/test_generators.py 2008-08-15 17:55:20 UTC (rev 5179) +++ branches/asm/Lib/test/test_generators.py 2008-08-15 18:37:14 UTC (rev 5180) @@ -1537,12 +1537,12 @@ ... SyntaxError: assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[23]>, line 1) ->>> def f(): (yield bar) = y +>>> def f(): (yield bar) = y #doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... SyntaxError: can't assign to yield expression (<doctest test.test_generators.__test__.coroutine[24]>, line 1) ->>> def f(): (yield bar) += y +>>> def f(): (yield bar) += y #doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... SyntaxError: augmented assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[25]>, line 1) Modified: branches/asm/src/org/python/antlr/GrammarActions.java =================================================================== --- branches/asm/src/org/python/antlr/GrammarActions.java 2008-08-15 17:55:20 UTC (rev 5179) +++ branches/asm/src/org/python/antlr/GrammarActions.java 2008-08-15 18:37:14 UTC (rev 5180) @@ -491,6 +491,8 @@ errorHandler.error("can't assign to generator expression", e); } else if (e instanceof Num) { errorHandler.error("can't assign to number", e); + } else if (e instanceof Yield) { + errorHandler.error("can't assign to yield expression", e); } else if (e instanceof Tuple) { //XXX: performance problem? Any way to do this better? exprType[] elts = ((Tuple)e).elts; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |