Subject: Re: [PATCH] python-shell-send functions show no output

From: Augusto Stoffel <[email-masked]>
Date: Fri, 03 Sep 2021 10:02:18 +0200

On Sat, 28 Aug 2021 at 17:41, Lars Ingebrigtsen <[email-masked]> wrote:

> Yes, it might be a good idea to raise this topic on emacs-devel and see
> if there's any feedback.

Okay, nobody chimed in on this thread (and I think I forgot to mention
it in emacs-devel), but this patch works well for me so far.  So I would
suggest to merge it.

>
> Some minor comments on the patch:
>
>> +(defvar python-shell-eval-setup-code
>> +  "\
>> +def __PYTHON_EL_eval(source, filename):
>> +    import ast, sys
>> +    if sys.version_info[0] == 2:
>> +        from __builtin__ import compile, eval, globals
>
> I think it might be a better long-term maintenance solution to put the
> Python code here (and from `python-shell-completion-native-setup') into
> a .py file under etc (for instance in a new "python-mode"
> sub-directory), and then read it in run-time (accessed via
> `data-directory', which points to etc), and cache it in an internal
> variable.
>
> Editing Python that's inside a Lisp string is awkward.

Yes, that makes sense.  On the other hand, it would make the entire
setup a bit more complicated, and I'm unsure about some of the details.
I do want to refactor `python-shell-send-file', though, so that at least
it doesn't generate Python code strings on the fly (and at the same time
solve the remaining part of Bug#32042).