Subject: bug#23095: 24.5; python-shell-unbuffered causes problems on Windows

From: Eli Zaretskii <[email-masked]>
Date: Wed, 23 Mar 2016 17:46:28 +0200

> Date: Tue, 22 Mar 2016 15:01:27 +0000
> From: Will Wykeham <[email-masked]>
> 
> (let ((process-environment (python-shell-calculate-process-environment))
>        (code (concat "import sys\n"
>                     "print(sys.ps1)")))
>   (with-temp-buffer
>     (let ((code-file (python-shell--save-temp-file code)))
>       (call-process "python" code-file '(t nil) nil "-i")
>       (delete-file code-file))
>     (buffer-string)))
> 
> In an 'out of the box' emacs, with 'python-shell-unbuffered' set to t as
> default, this evaluates to an empty string.
> 
> If python-shell-unbuffered is then set to nil, then the above evaluates to
> the expected ">>>\n".
> 
> I haven't got to the bottom of why unbuffered is causing this
> problem. My suspicion is that it relates to the fact that
> PYTHONUNBUFFERED on Windows also causes python to process stdin/stdout
> as binary (which also affects line ending processing).

On Windows, Emacs communicates with subprocesses via pipes, which are
buffered.