From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#50503: [PATCH] Properly encode all strings sent to the Python shell Date: Sat, 11 Sep 2021 15:32:26 +0200 Message-ID: <87sfybjl05.fsf@gmail.com> References: <87czpgww6a.fsf@gmail.com> <87tuispu2u.fsf@gnus.org> <87h7ese790.fsf@gmail.com> <87r1dvmgm4.fsf@gnus.org> <87bl4z1dub.fsf@gmail.com> <87ee9vmgb1.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22765"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 50503@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 11 15:33:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mP383-0005jn-JG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Sep 2021 15:33:11 +0200 Original-Received: from localhost ([::1]:49078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mP381-0001v2-Hf for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Sep 2021 09:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mP37u-0001uf-Vb for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 09:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mP37u-0004Ns-O8 for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 09:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mP37u-0005sy-Hm for bug-gnu-emacs@gnu.org; Sat, 11 Sep 2021 09:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Sep 2021 13:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50503 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 50503-submit@debbugs.gnu.org id=B50503.163136716222598 (code B ref 50503); Sat, 11 Sep 2021 13:33:02 +0000 Original-Received: (at 50503) by debbugs.gnu.org; 11 Sep 2021 13:32:42 +0000 Original-Received: from localhost ([127.0.0.1]:39777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP37a-0005sQ-1M for submit@debbugs.gnu.org; Sat, 11 Sep 2021 09:32:42 -0400 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:53095) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mP37X-0005sC-8S for 50503@debbugs.gnu.org; Sat, 11 Sep 2021 09:32:40 -0400 Original-Received: by mail-wm1-f48.google.com with SMTP id e26so3143546wmk.2 for <50503@debbugs.gnu.org>; Sat, 11 Sep 2021 06:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=WfSLkG7n0awQIyHKLh74wgsSw+Q2J9PkKF1yxhzXsyE=; b=bztWtoNA1phniQ7xa431HZXrlRVa/FqKVa6oIE/npFYy54M+NSTZBothkC12+mjNmX 5lOOF8VcGDO53e8+g60wn+zjJVIGtYShVJVJOuK8gjYWvWkUWDGadXN87mM0rtG1u047 HRbASsyqRWMEJWzVJCV2Sq66NIGhWKw+pwRb9E3EOt7jcDkhqOxDNsrXchi4dbk2B/Bc KI7sgNv3OESs89d6A5BlJIgWZKhoIRRVcwvkQkfVBF19Vkhq9PQe5czzId72yFesmfno A4fwSGNmbPsvo5qFji2in6CbVAmHNxr2bjryLr/3PF6+FqBw1SFXjD5o1dTKez9VN1iy uazw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=WfSLkG7n0awQIyHKLh74wgsSw+Q2J9PkKF1yxhzXsyE=; b=Ixsm7uYEOm6y+jwWeb36GD5qjdcK+Bo02tZ76FemjlZXU7MEHw0HH2Jp4jYdwz+vnz UDHzFrnCxv8JfgEnKri8BnESiFL9+s1qyOxY4Qe8wNucKo/3mqeui+vVmx8cq9Zv0BZV frL9n3N8vDWbnKCZgsEo/YLLggCaWIjkJcg5nlHrdMS3evUDDp1sI2yVbPWsAVY8MOV1 bM9gIKJAZhK6TH2q2uJ//4CQk0SUKbfqH1TqupwyF6x+CFDm1UgzwIIul9BrUYPePzaN P5tpBwM7iWrLfambTpPQiOJu7PhwKz26NXbrrjtMWQ7aXZJWkKqJdU9otv/KOorfWpbT GjCQ== X-Gm-Message-State: AOAM533aSvclnvkYC5/B4uj4WRONO5/pqRRvNHvL2vO1TzsBa0VtglYO 3LV974xRAT0xzjkHS07Q6rAHrWJxAlJNvg== X-Google-Smtp-Source: ABdhPJzu9TNEtsydBKFGDH1X8OGZhX3n5Ry0DyrBpohkCwHOq+r533IxEkmxojDqx6ssQ8Jovhv9eA== X-Received: by 2002:a1c:20cf:: with SMTP id g198mr2659527wmg.143.1631367153224; Sat, 11 Sep 2021 06:32:33 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id s13sm1616605wmc.47.2021.09.11.06.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 06:32:32 -0700 (PDT) In-Reply-To: <87ee9vmgb1.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 11 Sep 2021 14:45:38 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214078 Archived-At: --=-=-= Content-Type: text/plain On Sat, 11 Sep 2021 at 14:45, Lars Ingebrigtsen wrote: > Augusto Stoffel 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Keep-python.el-compatible-with-older-Emacsen.patch >From d2a6bd70d19f84592235691eb25356bcc5275880 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel 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) ""))))) (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 --=-=-=--