Skip to content

Commit

Permalink
Merge pull request #1671 from eihli/fix-1550
Browse files Browse the repository at this point in the history
Fix 1550: Minimize length of string sent to process-send-string
  • Loading branch information
galaunay committed Nov 15, 2020
2 parents 165c72d + bece2f2 commit e559220
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion elpy-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ If ASK-FOR-EACH-ONE is non-nil, ask before killing each python process."
If SIT is non-nil, sit for that many seconds after creating a
Python process. This allows the process to start up."
(let* ((bufname (format "*%s*" (python-shell-get-process-name nil)))
(let* ((process-connection-type
(if (string-equal system-type "darwin") nil t)) ;; see https://github.com/jorgenschaefer/elpy/pull/1671
(bufname (format "*%s*" (python-shell-get-process-name nil)))
(proc (get-buffer-process bufname)))
(if proc
proc
Expand Down
2 changes: 1 addition & 1 deletion test/elpy-module-yasnippet-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

(ert-deftest elpy-snippet-split-args ()
(elpy-testcase ()
(elpy-enable)
(python-mode)
(elpy-mode)
(let ((args "self, arg1, arg2 :int, arg3=4, arg4='message', arg5 :int, arg6 :float=65.4, *args, **kwargs"))
(should (equal (elpy-snippet-split-args args)
'("self" "arg1" "arg2" "arg3" "arg4" "arg5" "arg6" "*args" "**kwargs"))))
Expand Down
11 changes: 11 additions & 0 deletions test/elpy-shell-send-file-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(ert-deftest elpy-shell-send-file-should-accept-large-strings ()
(elpy-testcase ()
(elpy-enable)
(python-mode)
(let ((test-string (make-string 6000 ?a))
(process (elpy-shell-get-or-create-process)))
(python-shell-send-string
(format "print('start');foo='%s';print('end');" test-string) process)
(with-current-buffer (process-buffer process)
(elpy/wait-for-output "start")
(should (string-match "end" (buffer-string)))))))

0 comments on commit e559220

Please sign in to comment.