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: use PyOS_ReadlineFunctionPointer in non-interractive input
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: loewis Nosy List: greglielens, loewis, mwh
Priority: normal Keywords: patch

Created on 2004-05-18 13:41 by greglielens, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.readline greglielens, 2004-08-05 12:06 cvs diff -c from /python
Messages (9)
msg45988 - (view) Author: Gregory Lielens (greglielens) Date: 2004-05-18 13:41
Extend the control provided by
PyOS_ReadlineFunctionPointer to non-interractive
inputs. In addition, initialize
PyOS_ReadlineFunctionPointer to the default input
function, so that it can be retrieved by extern code
(allowing for embedding the old input function and
modifying it). Readline Module changed accordingly
(only modify PyOS_ReadlineFunctionPointer to
call_readline if input is interractive).
This was neccessary to modify the input behavior of
PyRun_InteractiveLoop, in case input is not interractive...
The application is a python driven parallel framework
using MPI, where the interractive process broadcast the
input lines to the non-interractive processes, who
listen...but other applications may benefit also.
patched: Modules/readline.c
               Parser/myreadline.c
msg45989 - (view) Author: Gregory Lielens (greglielens) Date: 2004-08-05 07:56
Logged In: YES 
user_id=1044428

I updated the patch to python current CVS, and do similar
modification in /Python/bltinmodule.c for builtin_raw_input
fonction.
builtin_raw_input now call PyOS_Readline when  stdin and
stdout objects are file, regardless if they are tty or not.
This one was forgotten in the first version of the patch,
and is needed to be able to use the same broadcasting
technique for parrallel interractive session when using
IPython. I now think that all functions implementing
possibly interractive input have been patched...
All regression tests pass except test_grp and test_pwd, but
those fail exactly the same way (KeyError) with non-patched
cvs...
Any chance to have this considered for 2.4?
Regards,
Greg.
msg45990 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-08-05 11:11
Logged In: YES 
user_id=6656

A chance, yes.  I'm a bit loath to change this, as I have no
idea why things were done this way in the first place.  If
it's the traditional "no good reason", then I guess this can
go in...

Also, I think your patch is backwards and doesn't adhere to
the local style wrt tabs and spaces.
msg45991 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-08-05 11:21
Logged In: YES 
user_id=6656

Uh, no, scratch that: I think your attempt to upload a new
patch failed.  Try again?
msg45992 - (view) Author: Gregory Lielens (greglielens) Date: 2004-08-05 12:02
Logged In: YES 
user_id=1044428

I edited the patch to comply with the tab style (or hope so).
For the reverse, I used cvs diff -c and assumed it would
produce it in the correct order, is it not the case? Anyway,
here is the new patch... (If it is still reversed and you
have a special option for cvs diff to produce the patch in
correct order, I am very interrested! ;-) )

Regarding the origin of the tty test, it is done (at least
for the stdin) since the first revision that used a
mechanism similar to the current one
(PyOS_ReadlineFunctionPointer), and this was done by Guido
(r2.11)
The test was removed just after (r2.12, again guido),
and finally re-introduced in it's final form in revision
2.28, by loewis.
Maybe I can assign him so that he gives us a idea of the
intention of this, and his feeling about this patch?
msg45993 - (view) Author: Gregory Lielens (greglielens) Date: 2004-08-13 08:52
Logged In: YES 
user_id=1044428

Hi,
as you are the last one which has worked on this subject, I
think it is best I reassign this patch to you. As you will
see from my discussion with mwh, the main  point of these
modif is to remove the test of the interractiveness of
stdin/stdout that prevent the use of
PyOS_ReadlineFunctionPointer when one is not interactive...

Hope this re-assignment is not rude, I do not know well
python development group usage in this matter...

Best regards, Greg
msg45994 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-11-27 16:45
Logged In: YES 
user_id=21627

I don't consider this assignment rude, but I don't think I
can do much about this patch for the next few months, either.
msg45995 - (view) Author: Gregory Lielens (greglielens) Date: 2005-11-27 17:43
Logged In: YES 
user_id=1044428

OK. I still think it is best to close this patch though: 
Since my patch, lisandro Dalcin submitted a very similar
patch and we collaborated on this and produced a new patch
(cleaner, against the current svn repository). 

I just submitted this new patch, hence I propose to close my
old one (and Lisandro will do the same with his) and mark it
as duplicate. Do you think it is best to let the new patch
unassigned or to assign it to you?

msg45996 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-11-27 18:11
Logged In: YES 
user_id=21627

I would leave it unassigned.
History
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40264
2004-05-18 13:41:33greglielenscreate