This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: readline function pointer with not tty's
Type: enhancement Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: dalcinl, mwh, terry.reedy
Priority: low Keywords:

Created on 2004-07-22 23:44 by dalcinl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg21759 - (view) Author: Lisandro Dalcin (dalcinl) Date: 2004-07-22 23:44
In Python 2.3.x C/C++ API,  the souce file Parser/myreadline.c in 
function PyOS_Readline() says:
        
        /* This is needed to handle the unlikely case that the
         * interpreter is in interactive mode *and* stdin/out are not
         * a tty.  This can happen, for example if python is run like
         * this: python -i < test1.py
         */
        if (!isatty (fileno (sys_stdin)) || !isatty (fileno (sys_stdout)))
                rv = PyOS_StdioReadline (sys_stdin, sys_stdout, prompt);
          else */
                rv = (*PyOS_ReadlineFunctionPointer)(sys_stdin, sys_stdout,
                                                     prompt);

When sys_stdin or sys_stdout are not a tty, there is not way of calling 
the readline function pointer.

I am working in a parallelized version of the Python interpreter, and I 
used the pointer to implement a specialized version of the readline 
function: it reads input in 'root' process (using the original readline 
function) and broadcasts string data to slaves. 

Some MPI implementations (i.e. MPICH) don seems to have stdin and 
stdout connected to a tty in processes other than the 'master' or 'root' 
one, being impossible to me to override the input mechanism.

My workaround was patching the sources, eliminating the if/else lines..

There is another way of handling the cases like
$ python -i < test1.py ????

Am I forgetting something?

Thanks in advance....
msg21760 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2004-07-29 23:55
Logged In: YES 
user_id=593130

Are you reporting a bug you think the developers should fix, a 
patch you think they should apply, or merely asking for info?  
If the latter, please close this and ask elsewhere, such as 
comp.lang.python or maybe even the developer list.
msg21761 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-08-07 17:19
Logged In: YES 
user_id=6656

I believe this is the same issue as patch 955928, which I'm still 
thinking about.
History
Date User Action Args
2022-04-11 14:56:05adminsetgithub: 40627
2004-07-22 23:44:09dalcinlcreate