Issue1460

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

Created on 2009-09-04.14:07:43 by funkychocobo, last changed 2014-05-02.13:46:14 by qny31541.

Messages
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)
   chain.kill(3)
   end = time.time()

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

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 
test_codeop.py?
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 
apparently.
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.
History
Date User Action Args
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