GNU bug report logs - #49822
28.0.50; python-shell-send functions show no output

Previous Next

Package: emacs;

Reported by: dalanicolai <at> gmail.com

Date: Mon, 2 Aug 2021 14:33:01 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #48 received at 49822 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 49822 <at> debbugs.gnu.org
Subject: Re: [RFC PATCH] python-shell-send functions show no output
Date: Sat, 28 Aug 2021 17:41:20 +0200
Augusto Stoffel <arstoffel <at> gmail.com> writes:

> The main user-visible change is that now a result is printed in the
> shell in all possible cases, i.e.:
>
> 1. If the string being evaluated is a one-line expression.
> 2. If the string being evaluated is a multiline expression such as
>    "(1+\n1)".
> 3. The string being evaluated is contains multiple statements, the last
>    of which is an expression.  E.g., "x=1\nx".
>
> Currently, only case 1 prints a result (this is the actual topic of this
> bug).

Sounds like a definite improvement.  :-)

> This is a reasonably sensitive change and it would be good to collect
> feedback from others before merging it (a properly formatted patch will
> then follow).  In particular, since I'm not an expert in Python's
> internals, there might be some possible refinements to the
> __PYTHON_EL_eval function.  Is this perhaps a better topic for the
> emacs-devel list?

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

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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 333 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.