Issue1170

classification
Title: InteractiveInterpreter partial parsing deadlock
Type: Severity: major
Components: Core Versions: 2.5alpha3
Milestone:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, pjenvey, sergei175
Priority: normal Keywords:

Created on 2008-11-11.19:47:29 by sergei175, last changed 2009-04-04.02:39:06 by pjenvey.

Messages
msg3772 (view) Author: Sergei (sergei175) Date: 2008-11-11.19:47:27
I've just tried the application 
http://dev.artenum.com/projects/jyconsole/download

The author  claims that what he did is to redirecte the standard 
error output from  InteractiveInterpreter of jython to his GUI.
It works only for certain type of errors. But some errors went
directly to my linux console!

For example, if I type:

>> H. [ENTER]

or

>> H" [ENTER]

the standard error stream goes to my Linux prompt, rather then
redirected to the standard error stream in InteractiveInterpreter
and shown in JyConsole.

The same problem exits for jython 2.2 and jython 2.5beta
(in 2.5 beta case, H. [ENTER] does not show any errors, but H"
shows errors still in my linux prompt)

So, it seems jython does not  redirect all errors to the
InteractiveInterpreter error stream, it stills redirects some error
to stdout of  the linux prompt
msg3773 (view) Author: Philip Jenvey (pjenvey) Date: 2008-11-11.22:41:41
We do output errors to stderr -- the problem here is our parsing in the 
interactive interpreter does not match CPython's behavior.

Our parser is incorrectly expecting more input here. You can see that if 
you try the same statement in the normal Jython interpreter (you'll get 
a '...' printed)

e.g. >> print 'foo[ENTER] should work correctly
msg3774 (view) Author: Sergei (sergei175) Date: 2008-11-11.23:29:08
Thanks. But How this will explain the statement like:

H" [enter]

if I use the standard Jython, this look as:
******************************************
>>> H"
Traceback (most recent call last):
  (no code object) at line 0
  File "<stdin>", line 1
        H"
         ^
SyntaxError: line 1:2 no viable alternative at character '\n' (<stdin>,
line 1)

***************************

so this looks fine. But if I'll do the same via
InteractiveInterpreter (like JyConsole
 http://dev.artenum.com/projects/jyconsole/download
)

I still get the same but ..  again on my Linux prompt, 
instead of the GUI. I'm sure the 
stderr stream errors have been redirected from 
InteractiveInterpreter to GUI in this project,
so nothing should be printed out on my linux console.
 

cheers,
msg3775 (view) Author: Philip Jenvey (pjenvey) Date: 2008-11-11.23:33:03
Redirecting is working for me:

Jython 2.5b0 (trunk:5540, Oct 31 2008, 13:55:41) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_07
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> from StringIO import StringIO
>>> sys.stderr = StringIO()
>>> H"    
>>> print sys.stderr.getvalue()
Traceback (most recent call last):
  (no code object) at line 0
  File "<stdin>", line 1
	H"
	 ^
SyntaxError: line 1:2 no viable alternative at character '\n' (<stdin>, 
line 1)

>>>
msg3776 (view) Author: Philip Jenvey (pjenvey) Date: 2008-11-11.23:39:09
well at least in the interactive interpreter via setting sys.stderr. I'm 
not exactly sure what jyconsole is doing
msg3777 (view) Author: Sergei (sergei175) Date: 2008-11-12.04:07:38
Hello, Phillip

I also see the correct redirection to my linux prompt, 
but it is not  the same as if you whould
redirect the stderr stream from InteractiveInterpreter when
embedding it to some java GUI. 
I've looked at the JyConsole souce - it just take stderr stream
InrteractiveInterpreter and prints it on Jtextarea.
It seems like not all error streams are  redirected, some error like
H" etc. still escape InteractiveInterpreter and printed to
the linux console instead of going through InrteractiveInterpreter.
msg4426 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-04-04.02:31:17
Marking this as normal so it doesn't block a release.
msg4428 (view) Author: Philip Jenvey (pjenvey) Date: 2009-04-04.02:39:06
JyConsole is using the older Jython 2.2, which it includes. So 
apparently this is a problem on 2.2

However 2.5 direct errors like the one described here to the right place 
-- this example works fine when you tweak JyConsole's classpath to use 
Jython 2.5.
History
Date User Action Args
2009-04-04 02:39:06pjenveysetstatus: open -> closed
resolution: works for me
messages: + msg4428
2009-04-04 02:31:17fwierzbickisetpriority: normal
messages: + msg4426
2009-03-30 15:58:23fwierzbickisetassignee: fwierzbicki ->
2009-03-14 02:25:02fwierzbickisetassignee: fwierzbicki
2008-11-14 23:51:39fwierzbickisetnosy: + fwierzbicki
2008-11-12 04:07:39sergei175setmessages: + msg3777
2008-11-11 23:39:09pjenveysetmessages: + msg3776
2008-11-11 23:33:03pjenveysetmessages: + msg3775
2008-11-11 23:29:09sergei175setmessages: + msg3774
2008-11-11 22:41:41pjenveysetnosy: + pjenvey
messages: + msg3773
title: Wrong error redirection in InteractiveInterpreter -> InteractiveInterpreter partial parsing deadlock
2008-11-11 19:47:29sergei175create