Message161586
| Author |
Kevin.Barry |
| Recipients |
Kevin.Barry |
| Date |
2012年05月25日.15:42:36 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1337960558.56.0.442179213708.issue14916@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 program with:
> gcc `python-config --cflags` working.c -o working `python-config --ldflags`
and run it with:
> ./working xterm -S/0
and you should see that there is no interactivity in the xterm that's opened.
Compile the attached file with:
> gcc -DREADLINE_HACK `python-config --cflags` working.c -o working `python-config --ldflags` -lreadline -lcurses
and run it with:
> ./working xterm -S/0
to see how it runs with my best attempt to get it to function properly with a readline hack. Additionally, try running:
> ./working xterm -S/0 > /dev/null
> ./working xterm -S/0 < /dev/null
both of which should cause interactivity in the xterm to fail, indicating that Python is checking stdin/stdout for tty status when determining if it should run interactively (i.e. it's not checking the tty status of the file passed to PyRun_InteractiveLoop.)
Am I somehow using this function wrong? I've been trying to work around this problem for a while, and I don't think I should be using readline hacks (especially since they don't port to other OSes with ptys, e.g. OS X.) I even tried to patch the call to PyOS_Readline in tok_nextc (Parser/tokenizer.c) to use tok->fp instead of stdin/stdout, which caused I/O to use the pty but it still failed to make interactivity work.
Thanks!
Kevin Barry |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年05月25日 15:42:38 | Kevin.Barry | set | recipients:
+ Kevin.Barry |
| 2012年05月25日 15:42:38 | Kevin.Barry | set | messageid: <1337960558.56.0.442179213708.issue14916@psf.upfronthosting.co.za> |
| 2012年05月25日 15:42:37 | Kevin.Barry | link | issue14916 messages |
| 2012年05月25日 15:42:37 | Kevin.Barry | create |
|