GNU bug report logs - #50503
[PATCH] Properly encode all strings sent to the Python shell

Previous Next

Package: emacs;

Reported by: Augusto Stoffel <arstoffel <at> gmail.com>

Date: Fri, 10 Sep 2021 10:41:02 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50503 in the body.
You can then email your comments to 50503 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Fri, 10 Sep 2021 10:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Augusto Stoffel <arstoffel <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 10 Sep 2021 10:41:02 GMT) Full text and rfc822 format available.

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

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Properly encode all strings sent to the Python shell
Date: Fri, 10 Sep 2021 12:40:29 +0200
[Message part 1 (text/plain, inline)]
Tags: patch

Some Python shell functions naively assume that '''<arbitrary text>'''
is valid Python code, which is not true, say, if the arbitrary text
ends with a quote sign.  This patch fixes this.

Some more remarks:

- python.el now depends on Emacs 28 because it uses 'format-prompt' and
  'comint-max-line-length' (luckily, only the latter is my fault).  Is
  this a problem?
- I've deleted some defcustoms which are not usable in my opinion.  The
  intended customizability is not impossible, but can only be achieved
  by advising certain functions.
- There are some long-obsolete functions (since say Emacs 24) that I
  would like to delete.  One example is 'python-send-string' which is
  easy to confuse with the 'python-shell-send-string', which is real
  deal.  What are the rules for this?

In GNU Emacs 28.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4)
 of 2021-09-09 built on toolbox
Repository revision: 8c023e5ea159c6756c92fd02643983aa449e0da9
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101002
System Description: Fedora 34 (Workstation Edition)

[0001-Properly-encode-all-strings-sent-to-Python-shell.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Fri, 10 Sep 2021 11:08:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 50503 <at> debbugs.gnu.org
Subject: Re: bug#50503: [PATCH] Properly encode all strings sent to the
 Python shell
Date: Fri, 10 Sep 2021 13:07:37 +0200
Augusto Stoffel <arstoffel <at> gmail.com> writes:

> Some Python shell functions naively assume that '''<arbitrary text>'''
> is valid Python code, which is not true, say, if the arbitrary text
> ends with a quote sign.  This patch fixes this.

Thanks; pushed to Emacs 28.

> Some more remarks:
>
> - python.el now depends on Emacs 28 because it uses 'format-prompt' and
>   'comint-max-line-length' (luckily, only the latter is my fault).  Is
>   this a problem?

Yes -- that was a mistake, so I've now reverted the usage of
format-prompt here.

> - There are some long-obsolete functions (since say Emacs 24) that I
>   would like to delete.  One example is 'python-send-string' which is
>   easy to confuse with the 'python-shell-send-string', which is real
>   deal.  What are the rules for this?

We don't have any specific rules here, but I think we can start removing
Emacs 24.x obsoletions when we get to Emacs 29.

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




bug marked as fixed in version 28.1, send any further explanations to 50503 <at> debbugs.gnu.org and Augusto Stoffel <arstoffel <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 10 Sep 2021 11:08:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Fri, 10 Sep 2021 16:17:02 GMT) Full text and rfc822 format available.

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

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 50503 <at> debbugs.gnu.org
Subject: Re: bug#50503: [PATCH] Properly encode all strings sent to the
 Python shell
Date: Fri, 10 Sep 2021 18:16:11 +0200
On Fri, 10 Sep 2021 at 13:07, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

>> - python.el now depends on Emacs 28 because it uses 'format-prompt' and
>>   'comint-max-line-length' (luckily, only the latter is my fault).  Is
>>   this a problem?
>
> Yes -- that was a mistake, so I've now reverted the usage of
> format-prompt here.

Thanks!  But note that there is at least one Emacs 28 dependency left,
namely `comint-max-line-length'.  There's also a byte-compiler warning
regarding `comint-highlight-input' even on Emacs 27.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Sat, 11 Sep 2021 12:40:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 50503 <at> debbugs.gnu.org
Subject: Re: bug#50503: [PATCH] Properly encode all strings sent to the
 Python shell
Date: Sat, 11 Sep 2021 14:38:59 +0200
Augusto Stoffel <arstoffel <at> gmail.com> writes:

> Thanks!  But note that there is at least one Emacs 28 dependency left,
> namely `comint-max-line-length'.

Perhaps there should be some compat code in that case?

> There's also a byte-compiler warning regarding
> `comint-highlight-input' even on Emacs 27.

Warnings are normal on older Emacs versions -- I mean, it'd be good to
avoid them, but we're mainly worried about actual breakages.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Sat, 11 Sep 2021 12:45:01 GMT) Full text and rfc822 format available.

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

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 50503 <at> debbugs.gnu.org
Subject: Re: bug#50503: [PATCH] Properly encode all strings sent to the
 Python shell
Date: Sat, 11 Sep 2021 14:44:28 +0200
On Sat, 11 Sep 2021 at 14:38, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Augusto Stoffel <arstoffel <at> gmail.com> writes:
>
>> Thanks!  But note that there is at least one Emacs 28 dependency left,
>> namely `comint-max-line-length'.
>
> Perhaps there should be some compat code in that case?

If it is stylistically acceptable, I think

  (or (bound-and-true-p comint-max-line-length) 1024)

is the simplest solution.  One could also replace the mysterious 1024 by
0, which was more or less the previous situation anyway.

>
>> There's also a byte-compiler warning regarding
>> `comint-highlight-input' even on Emacs 27.
>
> Warnings are normal on older Emacs versions -- I mean, it'd be good to
> avoid them, but we're mainly worried about actual breakages.

All right then.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Sat, 11 Sep 2021 12:46:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 50503 <at> debbugs.gnu.org
Subject: Re: bug#50503: [PATCH] Properly encode all strings sent to the
 Python shell
Date: Sat, 11 Sep 2021 14:45:38 +0200
Augusto Stoffel <arstoffel <at> gmail.com> writes:

> If it is stylistically acceptable, I think
>
>   (or (bound-and-true-p comint-max-line-length) 1024)
>
> is the simplest solution.  One could also replace the mysterious 1024 by
> 0, which was more or less the previous situation anyway.

Sure, that'd be fine.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Sat, 11 Sep 2021 13:33:02 GMT) Full text and rfc822 format available.

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

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 50503 <at> debbugs.gnu.org
Subject: Re: bug#50503: [PATCH] Properly encode all strings sent to the
 Python shell
Date: Sat, 11 Sep 2021 15:32:26 +0200
[Message part 1 (text/plain, inline)]
On Sat, 11 Sep 2021 at 14:45, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Augusto Stoffel <arstoffel <at> gmail.com> writes:
>
>> If it is stylistically acceptable, I think
>>
>>   (or (bound-and-true-p comint-max-line-length) 1024)
>>
>> is the simplest solution.  One could also replace the mysterious 1024 by
>> 0, which was more or less the previous situation anyway.
>
> Sure, that'd be fine.

I've attached a patch

[0001-Keep-python.el-compatible-with-older-Emacsen.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50503; Package emacs. (Sat, 11 Sep 2021 13:40:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 50503 <at> debbugs.gnu.org
Subject: Re: bug#50503: [PATCH] Properly encode all strings sent to the
 Python shell
Date: Sat, 11 Sep 2021 15:39:24 +0200
Augusto Stoffel <arstoffel <at> gmail.com> writes:

> I've attached a patch

Thanks; applied to Emacs 28.

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 10 Oct 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 199 days ago.

Previous Next


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