From: <fwi...@us...> - 2009-01-03 04:37:44
|
Revision: 5836 http://jython.svn.sourceforge.net/jython/?rev=5836&view=rev Author: fwierzbicki Date: 2009-01-03 04:37:38 +0000 (Sat, 03 Jan 2009) Log Message: ----------- The code: [i for i in range(10)] = (1, 2, 3) now properly fails to parse. test275.py -> test_codeop_jy.py Modified Paths: -------------- trunk/jython/Lib/test/test_codeop_jy.py trunk/jython/src/org/python/antlr/GrammarActions.java Removed Paths: ------------- trunk/jython/bugtests/test275.py trunk/jython/bugtests/test275s.py Modified: trunk/jython/Lib/test/test_codeop_jy.py =================================================================== --- trunk/jython/Lib/test/test_codeop_jy.py 2009-01-03 04:19:44 UTC (rev 5835) +++ trunk/jython/Lib/test/test_codeop_jy.py 2009-01-03 04:37:38 UTC (rev 5836) @@ -172,6 +172,7 @@ ai("del [1]") ai("del '1'") ai("if (a == 1 and b = 2): pass") + ai("[i for i in range(10)] = (1, 2, 3)") def test_filename(self): self.assertEquals(compile_("a = 1\n", "abc").co_filename, Deleted: trunk/jython/bugtests/test275.py =================================================================== --- trunk/jython/bugtests/test275.py 2009-01-03 04:19:44 UTC (rev 5835) +++ trunk/jython/bugtests/test275.py 2009-01-03 04:37:38 UTC (rev 5836) @@ -1,13 +0,0 @@ -""" - -""" - -import support - - -try: - import test275s -except SyntaxError: - pass -else: - raise support.TestError("Should raise a syntax error") Deleted: trunk/jython/bugtests/test275s.py =================================================================== --- trunk/jython/bugtests/test275s.py 2009-01-03 04:19:44 UTC (rev 5835) +++ trunk/jython/bugtests/test275s.py 2009-01-03 04:37:38 UTC (rev 5836) @@ -1,10 +0,0 @@ -""" - -""" - -try: - [i for i in range(10)] = (1, 2, 3) -except SyntaxError: - pass -else: - raise support.TestError("Should raise a syntax error") Modified: trunk/jython/src/org/python/antlr/GrammarActions.java =================================================================== --- trunk/jython/src/org/python/antlr/GrammarActions.java 2009-01-03 04:19:44 UTC (rev 5835) +++ trunk/jython/src/org/python/antlr/GrammarActions.java 2009-01-03 04:37:38 UTC (rev 5836) @@ -619,6 +619,8 @@ errorHandler.error("can't assign to repr", e); } else if (e instanceof IfExp) { errorHandler.error("can't assign to conditional expression", e); + } else if (e instanceof ListComp) { + errorHandler.error("can't assign to list comprehension", e); } else if (e instanceof Tuple) { //XXX: performance problem? Any way to do this better? List<expr> elts = ((Tuple)e).getInternalElts(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |