Title: Interactive Interpreter still buggy (same issue as 1365 back in 2.5rc1?)
Type: behaviour Severity: critical
Components: Core Versions: Jython 2.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: amak, funkychocobo, fwierzbicki, qny31541, zyasoft
Priority: high Keywords:

Created on 2009-09-04.14:07:43 by funkychocobo, last changed 2014-10-05.23:13:31 by zyasoft.

msg5102 (view) Author: JasonWickers (funkychocobo) Date: 2009-09-04.14:07:42
This was probably a similar issue to 1365, not sure of the severity 
but from our work, if the interactive interp isn't functional, 
debuggers (like pydev) seem to have issues. Debugging is cricial in my 
mind ^_^

Using 2.5.1rc1, copy (or type) the following code on windows 32 using 
jre 1.6.0_14 into the interactive interp:

for i in range(ITER):
   chain = Chain(40)
   end = time.time()

What i get is a never ending console that won't let me end the for 

Or effectively the output (note the extra ...'s are me hitting return 
repeatedly hoping for the for loop interactivity to eventually end 
being defined):
>>> for i in range(ITER):
...    chain = Chain(40)
...    chain.kill(3)
... end = time.time()
msg5117 (view) Author: JasonWickers (funkychocobo) Date: 2009-09-07.22:40:54
I guess i meant critical. This issue was also present in release 2.5.0. 
What it appears to be is the format:

test_str = "for i in range(5):\n   print i\nprint 'Ouch!'\n"

does not end the interactive evaluation. The below however does:
test_str = "for i in range(5):\n   print i\n\nprint 'Ouch!'\n"

note the extra '\n' after the for loop. This is also true for function 
definitions as well and is not limited to for loop termination.

probably could be added as a test string in test_valid of
msg5118 (view) Author: JasonWickers (funkychocobo) Date: 2009-09-07.23:00:37
In C Python 2.5.2, the above snippets would of raised a SyntaxError 
msg5125 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-09-09.13:19:22
The code you have provided is not enough to reproduce the problem, since
it doesn't define ITER or Chain.  If you could provide an example that
reproduces the problem that I can start with, I'll have much better luck
tracking it down.
msg5126 (view) Author: JasonWickers (funkychocobo) Date: 2009-09-09.13:24:15
The issue turns out is the inability for the interactive interpreter 
to raise a SyntaxError if a non-indented line follows (for example) a 
for loop or function declaration.

The following code reproduces the scenario:
>>> for i in range(5):
...    print i
... print 'Should raise Syntax Error'

So does:
>>> def myfunction():
...    print 'Hello World'
... print 'Should raise Syntax Error'

Extra dots are me hitting enter eky with no SyntaxError being 
generated by the last print statement.
msg5127 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-09-09.14:32:33
Reproduced, thanks.  This may not make it into 2.5.1 (just because of
timing), but will get fixed by 2.5.2.
msg9084 (view) Author: Jim Baker (zyasoft) Date: 2014-10-05.23:13:10
We now patch CPython since some commit in 2.7, so closing out:

$ jython27
Jython 2.7b3+ (default:9fef5da411e5+, Oct 3 2014, 16:52:21)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_21
Type "help", "copyright", "credits" or "license" for more information.
>>> for i in range(5):
...     print i
... print "blahs"
  File "<stdin>", line 3
    print "blahs"
SyntaxError: required (...)+ loop did not match anything at input 'print'

$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> for i in range(5):
...     print i
... print "blah"
  File "<stdin>", line 3
    print "blah"
SyntaxError: invalid syntax
msg9085 (view) Author: Jim Baker (zyasoft) Date: 2014-10-05.23:13:31
Ooops, match CPython :)
Date User Action Args
2014-10-05 23:13:31zyasoftsetmessages: + msg9085
2014-10-05 23:13:11zyasoftsetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg9084
nosy: + zyasoft
2014-05-02 13:46:14qny31541setnosy: + qny31541
2013-03-05 22:36:43amaksetkeywords: - console
2013-02-25 22:00:40amaksetkeywords: + console
2013-02-25 18:22:41fwierzbickisetpriority: high
versions: + Jython 2.5, - 2.5.1
2012-03-19 19:52:46amaksetnosy: + amak
2009-09-09 14:32:33fwierzbickisetassignee: fwierzbicki
resolution: accepted
messages: + msg5127
2009-09-09 13:24:16funkychocobosetmessages: + msg5126
2009-09-09 13:19:23fwierzbickisetnosy: + fwierzbicki
messages: + msg5125
2009-09-07 23:00:37funkychocobosetmessages: + msg5118
2009-09-07 22:40:54funkychocobosetmessages: + msg5117
2009-09-04 14:07:43funkychocobocreate