On Sun, Aug 27, 2023 at 2:26 PM Jack Kamm <jackkamm@gmail.com> wrote:
Ihor Radchenko <yantar92@posteo.net> writes:

> Confirmed.
>
> It looks like `python-shell-first-prompt-hook' does not get triggered
> in the described scenario with exit() and we enter infinite loop in the
> code below.

I think `python-shell-first-prompt-hook' is actually still triggered,
but rather it is `org-babel-comint-wait-for-output' that is hanging
while waiting for startup. However, we can just replace it with a
`sleep-for' instead, because we now wait for
`org-babel-python--initialized' anyways.

See the attached patch. Please let me know if it fixes the problem for
you.
 
Yes, this fixes the problem for me.  I made the change locally to release_9.6.6 on emacs 29.1.  I have the expected behavior back. thank you!

Peter