]> git.eshelyaron.com Git - emacs.git/commitdiff
Set tty mode to raw when setting up Inferior Python
authorkobarity <kobarity@gmail.com>
Fri, 16 Feb 2024 13:52:06 +0000 (22:52 +0900)
committerEshel Yaron <me@eshelyaron.com>
Wed, 28 Feb 2024 17:37:46 +0000 (18:37 +0100)
* 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)

(cherry picked from commit d5757178464ca51f79c7fc1ab199a1582e92ab32)

lisp/progmodes/python.el
test/lisp/progmodes/python-tests.el

index b7e43f3fc686eff5f71ee64316f3d9fd0baa1547..5501926e69de5a3069a5e4b0b47ed4a868a85cf7 100644 (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)
index af6c199b5bd03a78084a129f07f59ae26bf92613..6c6cd9eee2bf99cd251927d92434e5cf71e1c4da 100644 (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