unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 50503@debbugs.gnu.org
Subject: bug#50503: [PATCH] Properly encode all strings sent to the Python shell
Date: Sat, 11 Sep 2021 15:32:26 +0200	[thread overview]
Message-ID: <87sfybjl05.fsf@gmail.com> (raw)
In-Reply-To: <87ee9vmgb1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 11 Sep 2021 14:45:38 +0200")

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

On Sat, 11 Sep 2021 at 14:45, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Augusto Stoffel <arstoffel@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Keep-python.el-compatible-with-older-Emacsen.patch --]
[-- Type: text/x-patch, Size: 1218 bytes --]

From d2a6bd70d19f84592235691eb25356bcc5275880 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Sat, 11 Sep 2021 15:29:06 +0200
Subject: [PATCH] Keep python.el compatible with older Emacsen

* progmodes/python.el (python-shell-send-string): Don't assume
comint-max-line-length is defined.
---
 lisp/progmodes/python.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index e71a8102df..b17d740036 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3155,7 +3155,9 @@ python-shell-send-string
                       (python-shell--encode-string (or (buffer-file-name)
                                                        "<string>")))))
     (if (or (null (process-tty-name process))
-            (<= (string-bytes code) comint-max-line-length))
+            (<= (string-bytes code)
+                (or (bound-and-true-p comint-max-line-length)
+                    1024))) ;; For Emacs < 28
         (comint-send-string process code)
       (let* ((temp-file-name (with-current-buffer (process-buffer process)
                                (python-shell--save-temp-file string)))
-- 
2.31.1


  reply	other threads:[~2021-09-11 13:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 10:40 bug#50503: [PATCH] Properly encode all strings sent to the Python shell Augusto Stoffel
2021-09-10 11:07 ` Lars Ingebrigtsen
2021-09-10 16:16   ` Augusto Stoffel
2021-09-11 12:38     ` Lars Ingebrigtsen
2021-09-11 12:44       ` Augusto Stoffel
2021-09-11 12:45         ` Lars Ingebrigtsen
2021-09-11 13:32           ` Augusto Stoffel [this message]
2021-09-11 13:39             ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfybjl05.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=50503@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).