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

From: Will Wykeham <[email-masked]>
Date: Wed, 23 Mar 2016 16:05:38 +0000

On 23 March 2016 at 15:46, Eli Zaretskii <[email-masked]> wrote:
>> 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.

Ah. In which case, it sounds like the appropriate thing would be to
set the default value of 'python-shell-unbuffered' to nil on Windows.

Will