GNU bug report logs -
#43450
28.0.50; Python shell doesn't echo if shebang
Previous Next
Reported by: Gunnar Horrigmo <horrigmo <at> runbox.no>
Date: Wed, 16 Sep 2020 15:25:02 UTC
Severity: normal
Tags: fixed
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 #18 received at 43450 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> 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
This bug report was last modified 4 years and 236 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.