[Idle-dev] Why does IDLE use a subprocess?

James Schaffler jschaffler at proton.me
Sat Jun 3 21:41:17 EDT 2023


On Thursday, June 1st, 2023 at 2:37 PM, Tal Einat wrote:
> IDLE's use of a sub-process is not primarily about security.
>
> If one were to run user code within the same Python process (as IDLE originally did!), then the Python interpreter would be shared between the user code and IDLE.
>
> (It is today possible to run a (nearly entirely) separate Python interpreter within the same process, but that is a relatively new development from recent years.)
>
> Sharing the interpreter is a problem for various reasons, led by:
> * User code can break IDLE in many interesting and unexpected ways.
> * User code can block the main thread, which would make IDLE unresponsive.
>
> There are many other reasons too. For example, the "restart interpreter" feature is much harder, perhaps impossible, to implement.
>
> Let me know if you'd like any further details.
> - Tal Einat
Hi Tal,

This is a great answer, thank you so much! I didn't consider that blocking the main thread could be a problem. However, I would be interested to see in what additional "interesting and unexpected ways" one could break IDLE.

Thank you,
Jim


More information about the IDLE-dev mailing list