Set tty mode to raw when setting up Inferior Python

* lisp/progmodes/python.el (python-shell-setup-code): New constant.
(python-shell-comint-watch-for-first-prompt-output-filter): Send
`python-shell-setup-code' to the Inferior Python process.
* test/lisp/progmodes/python-tests.el (python-ffap-module-path-1):
Eliminate skipping on Mac. (Bug#68559)
This commit is contained in:
kobarity 2024-02-16 22:52:06 +09:00 committed by Mattias Engdegård
parent 0a4d4781dd
commit d575717846
2 changed files with 11 additions and 5 deletions

View file

@ -3521,6 +3521,16 @@ eventually provide a shell."
:version "25.1"
:type 'hook)
(defconst python-shell-setup-code
"\
try:
import tty
except ImportError:
pass
else:
tty.setraw(0)"
"Code used to setup the inferior Python processes.")
(defconst python-shell-eval-setup-code
"\
def __PYTHON_EL_eval(source, filename):
@ -3586,6 +3596,7 @@ The coding cookie regexp is specified in PEP 263.")
(format "exec(%s)\n" (python-shell--encode-string string))))))
;; Bootstrap: the normal definition of `python-shell-send-string'
;; depends on the Python code sent here.
(python-shell-send-string-no-output python-shell-setup-code)
(python-shell-send-string-no-output python-shell-eval-setup-code)
(python-shell-send-string-no-output python-shell-eval-file-setup-code))
(with-current-buffer (current-buffer)

View file

@ -5037,11 +5037,6 @@ import abc
(ert-deftest python-ffap-module-path-1 ()
(skip-unless (executable-find python-tests-shell-interpreter))
;; Skip the test on macOS, since the standard Python installation uses
;; libedit rather than readline which confuses the running of an inferior
;; interpreter in this case (see bug#59477 and bug#25753).
(skip-when (eq system-type 'darwin))
(trace-function 'python-shell-output-filter)
(python-tests-with-temp-buffer-with-shell
"
import abc