[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2013-03-25 Thread Kevin Barry
Kevin Barry added the comment: emmanuel, The Python interpreter isn't reentrant, so you could only run two interactive sessions connected to the same Python environment if you implemented your own REPL function that unlocked the GIL when waiting for input, then lock it just long enough

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2013-03-24 Thread Kevin Barry
Kevin Barry added the comment: emmanuel, Regarding your points: All three can be taken care of with a combination of my patch and setting sys.stdin, sys.stdout, and sys.stderr to the pty. (That should really be done internally with another patch, since os.fdopen is OS-specific. Also

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2013-03-17 Thread Kevin Barry
Kevin Barry added the comment: emmanuel, Thanks for the suggestion. Your workaround is exactly the same as using dup2 (in C) to replace stdin/stdout/stderr with the pty, however. If you added the following lines to your C code, it would have the same effect as the command-line redirection

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2013-03-17 Thread Kevin Barry
Kevin Barry added the comment: One additional issue, which my patch doesn't address, is that PyRun_InteractiveLoop should really take *two* FILE* arguments, with the second one being optional. This is because on Linux (and presumably on other *nixes) if a read operation is blocked on a file

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-10-08 Thread Kevin Barry
Kevin Barry added the comment: I still see the potential cause addressed by my patch in the 2.7, 3.3, and default branches, so I'm assuming that all versions from 2.6 on have this problem. I also see that I can elect to change the Status and Resolution of this report. Does that mean I need

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-24 Thread Kevin Barry
Kevin Barry ta0k...@gmail.com added the comment: The patch from before needed a slight modification for when Python actually defaults to an interactive session on stdin. Since I rebuild this for my current distro (Slackware64 13.37,) I switched to the Python 2.6.6 source. This might

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-24 Thread Kevin Barry
Kevin Barry ta0k...@gmail.com added the comment: I've attached a simplified example program (working3.c) that demonstrates both the original problem and that the patch (Python-2.6.6-Run_Interactive-fix.patch) works. It eliminates the need for a pty, 'xterm', and redirection. Compile

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-23 Thread Kevin Barry
Kevin Barry ta0k...@gmail.com added the comment: Here is a patch that corrects the problem (quoted below and attached.) This only corrects the problem when 'PyOS_ReadlineFunctionPointer' is set, e.g. you must 'import readline', otherwise Python will defer to stdin/stdout

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-23 Thread Kevin Barry
Kevin Barry ta0k...@gmail.com added the comment: I've attached a new example source file to demonstrate the fix. Compile the attached program with (*after* patching and installing Python): gcc `python-config --cflags` working2.c -o working2 `python-config --ldflags` and run

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-05-25 Thread Kevin Barry
New submission from Kevin Barry ta0k...@gmail.com: I have been trying to get PyRun_InteractiveLoop to run on a pty (Linux) without replacing stdin and stdout with that pty; however, it seems like Python (2.6.6) is hard-coded to only run interactively on stdin and stdout. Compile the attached