[ python-Bugs-996259 ] readline function pointer with not tty's

SourceForge.net noreply at sourceforge.net
Fri Jul 30 02:09:28 CEST 2004


Bugs item #996259, was opened at 2004-07-22 23:44
Message generated for change (Settings changed) made by dalcinl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=996259&group_id=5470

Category: Parser/Compiler
Group: Feature Request
Status: Open
Resolution: None
>Priority: 1
Submitted By: Lisandro Dalcin (dalcinl)
Assigned to: Nobody/Anonymous (nobody)
Summary: readline function pointer with not tty's

Initial Comment:
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....

----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-07-29 23:55

Message:
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=996259&group_id=5470


More information about the Python-bugs-list mailing list