Re: Make the "python" command resemble the standard Python interpreter

Khoo Yit Phang
2012-01-12T16:48:36Z

Hi,

On Jan 12, 2012, at 11:40 AM, Doug Evans wrote:

> There already is an established behaviour for python without arguments
> (with or without a terminal).
>
> (gdb) python
>> print 1 + 2
>> end
> 3
> (gdb)
>
> I've read the thread and I don't seen anyone raising this issue (could
> have missed it though. I saw Tom's message re: what output CLI will
> generate, but this is about behaviour).
> I've read the patch and I don't think using from_tty is ok to select
> between the different behaviours.

Can you explain why?

> Can we pick a different way of invoking the python interpreter?

I had suggested in my original patch to use PyRun_FileExFlags when from_tty is false, which is how the Python interpreter picks the different behavior (Py_Main), so both from_tty and not from_tty would resemble Python. This would also eliminate the need for handling python in cli/cli-script.c and other places.

Yit
January 12, 2012