From unknown Mon Jun 23 02:24:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43450: 28.0.50; Python shell doesn't echo if shebang Resent-From: Gunnar Horrigmo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Sep 2020 15:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43450 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 43450@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16002698937118 (code B ref -1); Wed, 16 Sep 2020 15:25:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Sep 2020 15:24:53 +0000 Received: from localhost ([127.0.0.1]:35719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIZIi-0001qj-QQ for submit@debbugs.gnu.org; Wed, 16 Sep 2020 11:24:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:35458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIXPd-0006ft-3t for submit@debbugs.gnu.org; Wed, 16 Sep 2020 09:23:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIXPc-0004BC-Tc for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2020 09:23:52 -0400 Received: from aibo.runbox.com ([91.220.196.211]:46998) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIXPY-0004GE-CB for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2020 09:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.no; s=selector2; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=l9blXYDCB4jQjzgnMATM6fg901vyfUkfNS0ePPyP7Ek=; b=VrNdwPIHOjh9yt7u7A2GgL3dN KSaVhn/uH9PVSd5+LAdYBrdVcPQdlYSE37TYhgerCwPtRGmgMVS5W2bsddEkB1jvmWACAt7EtAl46 UWvsxoKmxN3slS2NnH9mRSpHG0iha2QcmJhmdXRG4ouAXt+SIzVm5/WzAZ+R746N1nERIyDvZH1km KYgoyymo3+sHWDV4Jjh0/ryzHxi33yCcn70EV4I2Zf+t6Nb2xXVqJwS5o9SIqmrv3Qjh3cyw/t9Kg 3TH2AD3vHGoP2tHn9OG3GmTioklCYa97fpgO470g3YgrbSaBTyMIPueoOcwsGNt74dratdT7B+y6S wQxK3jbgA==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1kIXPM-0004Yd-Fa for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2020 15:23:36 +0200 Received: by submission03.runbox with esmtpsa [Authenticated alias (9149)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1kIXP8-0000BO-9N for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2020 15:23:22 +0200 From: Gunnar Horrigmo Date: Wed, 16 Sep 2020 15:23:22 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=91.220.196.211; envelope-from=horrigmo@runbox.no; helo=aibo.runbox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/16 09:23:37 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Mailman-Approved-At: Wed, 16 Sep 2020 11:24:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Open a .py file M-x run-python RET In .py file, write some statement, say "1+2" and evaluate it with (f.ex.) python-shell-send-statement. Observe that python shell echoes the result, "3", and prompts on a new line. Add a shebang to the top of .py file (f.ex. "#!/usr/bin/pyton3" on my system). Evaluate the same statement as over. Observe that python shell doesn't echo the result, but does print a new prompt, but without a newline. You can add and remove the shebang as much you want, and see the echo behaviour change accordingly. You do _not_ need to save the file. You can see a replay of the issue here: https://asciinema.org/a/DOq15ldlyiKI5HKLrKpF7gIeg I've verified this behaviour using emacs -Q on versions 28.0.50 (including master HEAD as of 2020-09-16) and 27.1.50. And it seems all the python-shell-send-* functions exhibit the same, not just python-shell-send-statement. In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.13, cairo version 1.16.0) of 2020-05-23 built on hot-rats.uio.no Repository revision: f8581bcf6a1942ebd331cae20e32945a3a86a3d1 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12008000 System Description: Fedora 31 (Workstation Edition) Recent messages: Checking 71 files in /home/horrigmo/src/emacs/emacs/lisp/erc... Checking 34 files in /home/horrigmo/src/emacs/emacs/lisp/emulation... Checking 180 files in /home/horrigmo/src/emacs/emacs/lisp/emacs-lisp... Checking 24 files in /home/horrigmo/src/emacs/emacs/lisp/cedet... Checking 59 files in /home/horrigmo/src/emacs/emacs/lisp/calendar... Checking 87 files in /home/horrigmo/src/emacs/emacs/lisp/calc... Checking 105 files in /home/horrigmo/src/emacs/emacs/lisp/obsolete... Checking for load-path shadows...done C-x C-g is undefined [2 times] Buffer *unsent mail to bug-gnu-emacs@gnu.org* modified; kill anyway? (y or n) y Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER LCMS2 GMP Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: ERC Minor modes in effect: erc-list-mode: t erc-menu-mode: t erc-ring-mode: t erc-networks-mode: t erc-pcomplete-mode: t erc-button-mode: t erc-fill-mode: t erc-stamp-mode: t erc-netsplit-mode: t erc-autojoin-mode: t erc-track-mode: t erc-track-minor-mode: t erc-match-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-move-to-prompt-mode: t erc-readonly-mode: t shell-dirtrack-mode: t savehist-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t Load-path shadows: None found. Features: (shadow emacsbug erc-list erc-menu erc-ring erc-networks erc-pcomplete erc-button erc-fill erc-stamp erc-netsplit erc-join erc-track erc-match erc-goodies erc erc-backend erc-compat thingatpt pp erc-loaddefs mailalias bbdb-message nnir vc-git diff-mode easy-mmode sort gnus-cite smiley shr-color mm-archive mail-extr gnus-async gnus-bcklg mule-util qp gnus-ml disp-table gnus-topic nndraft nnmh utf-7 gnutls bbdb-gnus network-stream nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 nntp gnus-cache gnus-sum url url-proxy url-privacy url-expand url-methods url-history shr url-cookie url-domsuf url-util svg xml dom gnus-group gnus-undo powerline advice powerline-separators color cyberpunk-theme powerline-themes cus-edit cus-start cus-load tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat shell pcomplete comint ansi-color ring ls-lisp ido nnfolder smtpmail sendmail mm-view mml-smime smime dig mailcap gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time iso8601 gnus-spec gnus-int gnus-range message rmc puny format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search time-date mail-utils mm-util mail-prsvr wid-edit server pinentry epa-file epa derived epg epg-config yatemplate autoinsert cl-extra yasnippet help-mode edmacro kmacro dired-sidebar face-remap dired-subtree dired-hacks-utils dash dired dired-loaddefs bbdb-mua bbdb-com crm mailabbrev bbdb bbdb-site timezone finder-inf info package easymenu browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt bytecomp byte-compile cconv make-password cl-macs help-misc markstack cl doders html-misc stoffe-misc gv savehist avoid cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 441208 78375) (symbols 48 30936 1) (strings 32 123601 7188) (string-bytes 1 3885469) (vectors 16 47667) (vector-slots 8 1304186 200108) (floats 8 378 407) (intervals 56 4655 1922) (buffers 992 33)) -- Gunnar From unknown Mon Jun 23 02:24:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43450: 28.0.50; Python shell doesn't echo if shebang Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Sep 2020 16:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43450 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gunnar Horrigmo Cc: =?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina , 43450@debbugs.gnu.org Received: via spool by 43450-submit@debbugs.gnu.org id=B43450.16014846335222 (code B ref 43450); Wed, 30 Sep 2020 16:51:02 +0000 Received: (at 43450) by debbugs.gnu.org; 30 Sep 2020 16:50:33 +0000 Received: from localhost ([127.0.0.1]:32909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNfJI-0001M6-9R for submit@debbugs.gnu.org; Wed, 30 Sep 2020 12:50:33 -0400 Received: from quimby.gnus.org ([95.216.78.240]:47278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNfJD-0001Lj-OF for 43450@debbugs.gnu.org; Wed, 30 Sep 2020 12:50:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yugEHl23LPD5UjV6Pr8vI67WRvzBA5UvYax54MXL3W8=; b=ehd8t7xWOdbDF/HV6VfdVZcQbB 2HGSeETvK2ZAogIYAjIOvy4pWENJUdq0AjjLtbyemyEYFJdngD8ZqGm12vd3848QWrQeiBRB9qv0X mADafbR5FYe2RGwMzdO6abR9vBDa9oUBZ6JY5nWmpgp0InOT01ZOlxjOnswnTabdGPLg=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNfJ4-0003c0-Gy; Wed, 30 Sep 2020 18:50:21 +0200 From: Lars Ingebrigtsen References: X-Now-Playing: Thee Oh Sees's _Putrifiers II_: "So Nice" Date: Wed, 30 Sep 2020 18:50:16 +0200 In-Reply-To: (Gunnar Horrigmo's message of "Wed, 16 Sep 2020 15:23:22 +0200") Message-ID: <87362z2oqf.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Gunnar Horrigmo writes: > Open a .py file > M-x run-python RET > In .py file, write some statement, say "1+2" and evaluate it with > (f.ex.) python-shell-send-statement. Observe that python shell echoes > the result, "3", an [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Gunnar Horrigmo writes: > Open a .py file > M-x run-python RET > In .py file, write some statement, say "1+2" and evaluate it with > (f.ex.) python-shell-send-statement. Observe that python shell echoes > the result, "3", and prompts on a new line. > > Add a shebang to the top of .py file (f.ex. "#!/usr/bin/pyton3" on my > system). Evaluate the same statement as over. Observe that python shell > doesn't echo the result, but does print a new prompt, but without a > newline.=20 I can reproduce this in Emacs 28, but it doesn't seem to be triggered by the shebang: Adding some blank lines to the top of the buffer also triggers the error. Or ... anything: (python-shell-buffer-substring 2 (point) nil) =3D> "# -*- coding: utf-8 -*- 1+2" (python-shell-buffer-substring 1 (point) nil) =3D> "1+2" (fillstr (when (not starts-at-point-min-p) (concat (format "# -*- coding: %s -*-\n" encoding) (make-string ;; Subtract 2 because of the coding cookie. (- (line-number-at-pos start) 2) ?\n))))) This was added by (in a slightly different form): commit 2dd5163d764f395eb31a2306dba385d123af4aba Author: Fabi=C3=A1n Ezequiel Gallina AuthorDate: Sat Dec 27 01:30:21 2014 -0300 python.el: Handle file encoding for shell. =20=20=20=20 * lisp/progmodes/python.el (python-rx-constituents): Add coding-cookie. (python-shell--save-temp-file): Write file with proper encoding. (python-shell-buffer-substring): Add coding cookie for detected encoding to generated content. Fix blank lines when removing if-name-main block. (python-shell-send-file): Handle file encoding. (python-info-encoding-from-cookie) (python-info-encoding): New functions. I've added Fabi=C3=A1n to the Cc, perhaps he has some insight here... --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Mon Jun 23 02:24:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43450: 28.0.50; Python shell doesn't echo if shebang Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Oct 2020 03:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43450 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gunnar Horrigmo Cc: =?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina , 43450@debbugs.gnu.org Received: via spool by 43450-submit@debbugs.gnu.org id=B43450.1601609603767 (code B ref 43450); Fri, 02 Oct 2020 03:34:02 +0000 Received: (at 43450) by debbugs.gnu.org; 2 Oct 2020 03:33:23 +0000 Received: from localhost ([127.0.0.1]:38945 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOBox-0000CE-D3 for submit@debbugs.gnu.org; Thu, 01 Oct 2020 23:33:23 -0400 Received: from quimby.gnus.org ([95.216.78.240]:38886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOBos-0000Bx-UI for 43450@debbugs.gnu.org; Thu, 01 Oct 2020 23:33:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=aveiR+7/Ex9KpOlDvu7RKjw56IOBokCHiwcHq9JHnAU=; b=bOot8jX0NJy4GGp1JcwNiQzBg7 iAX7reZWnME62epUHxldpYtx6Acc30VTNxt5s6BlQ2OfxxW12w8UwOQ9xuktGf6GIXgkIYWB3/NjP 0se6QW6iGjpRQRyzKhrzPEPl5Q9VgFvAsePiCQCIk2vEuQNLey2xqJ3WTeYBHFFuoUDQ=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kOBof-00073T-VD; Fri, 02 Oct 2020 05:33:12 +0200 From: Lars Ingebrigtsen References: <87362z2oqf.fsf@gnus.org> X-Now-Playing: Stephan Mathieu's _On Tape_: "(untitled)" Date: Fri, 02 Oct 2020 05:33:04 +0200 In-Reply-To: <87362z2oqf.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 30 Sep 2020 18:50:16 +0200") Message-ID: <87r1qhz4i7.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > I can reproduce this in Emacs 28, but it doesn't seem to be triggered by > the shebang: Adding some blank lines to the top of the buffer also > triggers the error. Or ... anything: > > (python-shell [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > I can reproduce this in Emacs 28, but it doesn't seem to be triggered by > the shebang: Adding some blank lines to the top of the buffer also > triggers the error. Or ... anything: > > (python-shell-buffer-substring 2 (point) nil) > => "# -*- coding: utf-8 -*- > > 1+2" I have to admit that I don't understand the reason for the coding cookie at all -- we bind coding-system-for-write to utf-8 before writing the temp file anyway, and on the Python side, we specify the coding system explicitly there, too. But in case it does have an effect, I haven't removed it altogether, but instead made the C-c C-e command avoid outputting it, which fixes the problem. C-M-x, probably a more important command, is not affected by the cookie one way or another (since it's just side-effecting), so I've left it alone there. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 01 23:33:25 2020 Received: (at control) by debbugs.gnu.org; 2 Oct 2020 03:33:26 +0000 Received: from localhost ([127.0.0.1]:38947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOBoz-0000CR-KD for submit@debbugs.gnu.org; Thu, 01 Oct 2020 23:33:25 -0400 Received: from quimby.gnus.org ([95.216.78.240]:38902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOBox-0000C2-62 for control@debbugs.gnu.org; Thu, 01 Oct 2020 23:33:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=w6teJ+i9HFQGGJPrBVq87RdOD0RCJVhNtwW/XRPOJ/U=; b=I6O/9kFToYIYLA44QcDOzqZDwr RKILiWaC4+o1AFHnR9fQnUra1935kpdpL1UhHVspoIpe3WshArW7PTRf2WKdeAThY/3GBxBKnLAT4 gipuJjV18hjU2935yo2qiAuSGi6L7YGSc3nwELl8SZIfr57Qg01Z9avRl/Mv9UV750Hw=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kOBop-00073e-Fl for control@debbugs.gnu.org; Fri, 02 Oct 2020 05:33:17 +0200 Date: Fri, 02 Oct 2020 05:33:14 +0200 Message-Id: <87pn61z4hx.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #43450 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 43450 fixed close 43450 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 43450 fixed close 43450 28.1 quit From unknown Mon Jun 23 02:24:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43450: 28.0.50; Python shell doesn't echo if shebang Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Oct 2020 03:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43450 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed To: Gunnar Horrigmo Cc: 43450@debbugs.gnu.org Received: via spool by 43450-submit@debbugs.gnu.org id=B43450.16016100521465 (code B ref 43450); Fri, 02 Oct 2020 03:41:01 +0000 Received: (at 43450) by debbugs.gnu.org; 2 Oct 2020 03:40:52 +0000 Received: from localhost ([127.0.0.1]:38956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOBwC-0000NZ-Ei for submit@debbugs.gnu.org; Thu, 01 Oct 2020 23:40:52 -0400 Received: from quimby.gnus.org ([95.216.78.240]:39042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOBw8-0000NI-E7 for 43450@debbugs.gnu.org; Thu, 01 Oct 2020 23:40:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=B3Lfd0yzF8mkFrJx1sBxbf37b5rJqrhsylLgbS8Z6ko=; b=LTSAsuLfNQeAzX1bmJ3R2Uic0z VYsDSFCdHWu9sf9X/UxZdTRlBSOcJhBFRJ7Ix4UAb3Sq2bfPpEiAeTx562VZVJmkKZzhRB8+U+Zbo lnmRudHTk2C0qK6jgxSUQxLkvz5BOE2Vr9Zm8yj6dpSRmzLRK4URxNH3aFA0H+z+TGrg=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kOBvy-00077C-Vn; Fri, 02 Oct 2020 05:40:41 +0200 From: Lars Ingebrigtsen References: <87362z2oqf.fsf@gnus.org> <87r1qhz4i7.fsf@gnus.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEW9va6Kh3hkWVZH PDr///+UfqoJAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+QKAgMkHTEQEDgAAAGaSURBVDjLZZOLtQMh CERhKxAqWLQD7b+3N4MafYl7ogl3B+QTERGvc1kdo4holbUSeA3zkbZaFngIohrXP+D0gsci7Xor wgxbqPy4AhjcpVwKpa9SW4+vGEuRwApBuW6VQK18BUd0gFfp6wCbebRe09WtCK/d6UrU7gSjhro3 7AVAr8wLPsxQca9iF8BlOyrirNYGKuXBXZw55FaWKxPDixoJNFMjUMEbnnkQZOIATAdANzAvsyRC TdhTX6SCqPakCbViMfFzKwIAR32pw1eC4tkodtFqvMKalWeWaoKK6wZuOptMMNoCcKVqG2CkRmXZ GQNDoQe0bNQEUg7obRA4HuRhB8BXzyoi37KavoN3nuhIzfw+ADFSlRcTO6AukEUUPzEI2gbFLgDj 0z1YcDmu0PJe48E4sEhygnOCAiDH6QZoEsNE/rGo39OOEXVbsXItQUuRsSsN1g6QowCA4voMleeQ j7qnbtYFBgJmDHXb7vOUE27ss48Fxja0cZYcOwEjwFVrAOO8NwGbmWBc4ArevkDvg3kNGb+KXH8p Hmz33toaLQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMC0xMC0wMlQwMzozNjoyOCswMDowMLanS0UA AAAldEVYdGRhdGU6bW9kaWZ5ADIwMjAtMTAtMDJUMDM6MzY6MjgrMDA6MDDH+vP5AAAAAElFTkSu QmCC X-Now-Playing: Stephan Mathieu's _On Tape_: "(untitled)" Date: Fri, 02 Oct 2020 05:40:37 +0200 In-Reply-To: <87r1qhz4i7.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 02 Oct 2020 05:33:04 +0200") Message-ID: <87lfgpz45m.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > I have to admit that I don't understand the reason for the coding cookie > at all -- we bind coding-system-for-write to utf-8 before writing the > temp file anyway, and on the Python side, we specif [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > I have to admit that I don't understand the reason for the coding cookie > at all -- we bind coding-system-for-write to utf-8 before writing the > temp file anyway, and on the Python side, we specify the coding system > explicitly there, too. OK, I think this is basically the point of it all: (defun python-shell--save-temp-file (string) (let* ((temporary-file-directory (if (file-remote-p default-directory) (concat (file-remote-p default-directory) "/tmp") temporary-file-directory)) (temp-file-name (make-temp-file "py")) (coding-system-for-write (python-info-encoding))) (with-temp-file temp-file-name (insert string) (delete-trailing-whitespace)) temp-file-name)) If the current buffer has a coding cookie, we use that in the temp files we load, too. That's logical (er, somewhat, why not just use the current buffer coding system?), but if there's no coding cookie, we still add one, which isn't. Anyway, I think the change I made is unlikely to break anything... possibly... unless you have a Python file with a coding system cookie, and you're eval-ing a non-ASCII string, and it's not all utf-8. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no