From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#21376: 25.0.50; Python tests fail on MS-Windows -- issues with the prompt Date: Tue, 15 Aug 2017 21:41:18 -0400 Message-ID: <87mv70z3up.fsf@users.sourceforge.net> References: <83bndq2slu.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1502847617 22228 195.159.176.226 (16 Aug 2017 01:40:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 16 Aug 2017 01:40:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 21376@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 16 03:40:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhnJa-0005EZ-Ft for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Aug 2017 03:40:10 +0200 Original-Received: from localhost ([::1]:33933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhnJd-0002fx-Rl for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Aug 2017 21:40:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhnJX-0002cj-EZ for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2017 21:40:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhnJS-0005Cs-CK for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2017 21:40:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59612) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dhnJS-0005Cg-3i for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2017 21:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dhnJR-00089n-P7 for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2017 21:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Aug 2017 01:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21376 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21376-submit@debbugs.gnu.org id=B21376.150284758931331 (code B ref 21376); Wed, 16 Aug 2017 01:40:01 +0000 Original-Received: (at 21376) by debbugs.gnu.org; 16 Aug 2017 01:39:49 +0000 Original-Received: from localhost ([127.0.0.1]:40060 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhnJE-00089A-JO for submit@debbugs.gnu.org; Tue, 15 Aug 2017 21:39:48 -0400 Original-Received: from mail-it0-f50.google.com ([209.85.214.50]:38875) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhnJC-00088r-Rt; Tue, 15 Aug 2017 21:39:47 -0400 Original-Received: by mail-it0-f50.google.com with SMTP id m34so11650115iti.1; Tue, 15 Aug 2017 18:39:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=uUKXbWrDmowHWINnriGPE7ucbEI6V6ahWVbn4KAw8aY=; b=pSTHlPG9BGV/DHb1zlob87aqrU7rd1tUQxmSGfY91boa23qpfKe9X7lhdG8QawdoYC KMYTrYJrtU744qKpUWA891DCWjnD8/xGgWtjz+as3Ytc+rzFEmSLAE7LRDm/WsjmQ8HP mfF0tNnlhu5uV07NQ5HcRUEUTZb/H/6vltxg7gn6+Q2P54hI3vsZqoGDJm8+zqAGm2Mv pPZbkjjlYkvWLII5ykj7kPBjJHiVMryC8H+1TmPNv1ufAwXnEf5bf0veHFgiDPKsW66K qAHT7HgpjmG6U619Gk6h5Fz3PWYYxJrFT5ezSmF4jIxAmo2MS4Fcz8a0dPoSYwAAEAIJ FP7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=uUKXbWrDmowHWINnriGPE7ucbEI6V6ahWVbn4KAw8aY=; b=kEy4N1+0nDGtekJlcRz57zF8k/myQT9U6WcpODAqDFGM1YaCwbBag32ONgQ6WfbvWs rDAG11aFLGyMjQtoJssSv0DQWjtqVj3BOW1kVZg2yBWT6M+Dp9tZoB0nZu71L5JdRJgh uUR1XV2TEzm+83Q+KfVezi8ciXIN7YvMon8lC7sbZhX7Hs8ESt2EILROadeW6iatuUYV DrhI174lYoySHaRkFDHNYUit9n3uxu6ZHGWugkt7ErPU8F8mTNPtqkjixH94MAme60oA gTv+xheY39kWB6vEBXr5aiv+0nf3wQnjAL3y7pXyo+kZN/QPBVKDgp2PigwFnAL/flUd aRpQ== X-Gm-Message-State: AHYfb5iuVQgINjt4jn5eTP5wX22+vlVMNx9AN2JgliW0CyaTgimtemor EaIuNOW3btEIoiSN X-Received: by 10.36.34.80 with SMTP id o77mr501596ito.121.1502847581007; Tue, 15 Aug 2017 18:39:41 -0700 (PDT) Original-Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id l191sm9361itl.13.2017.08.15.18.39.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2017 18:39:40 -0700 (PDT) In-Reply-To: <83bndq2slu.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 29 Aug 2015 15:21:01 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135797 Archived-At: --=-=-= Content-Type: text/plain tags 21376 + patch quit Eli Zaretskii writes: > 4 of the Python tests fail on MS-Windows due to some issue related to > the prompts displayed by the Python interpreter. The 4 failed tests > are: > > FAILED python-shell-make-comint-4 > FAILED python-shell-prompt-detect-1 > FAILED python-shell-prompt-detect-2 > FAILED python-shell-prompt-set-calculated-regexps-6 > > I show below the relevant portions of python-tests.log. > > I need help in figuring out what causes these. One possible suspect > is some buffering issue, due to which Emacs does not receive the > prompt that Python prints. Another possibility might be the version > of the Python (I have 2.6.6 installed). Or maybe something else. It seems to be a bug in Python 2.x on Windows (Python 3.6.x doesn't show the problem). In unbuffered mode it rejects carriage returns. Compare results of printf 'print("hello world")\r\n' > hello-world-with-crnl.py python -i < hello-world-with-crnl.py python -i -u < hello-world-with-crnl.py printf 'print("hello world")\n' > hello-world-with-nl.py python -i < hello-world-with-nl.py python -i -u < hello-world-with-nl.py (Setting the PYTHONUNBUFFERED environment variable, as python.el does, is equivalent to passing '-u'.) The bug can be worked around with the following patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Work-around-w32-python-2.7-bug-to-fix-prompt-dete.patch Content-Description: patch >From a8b2295d38f50044e0396c29aefd5f465e848c84 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 15 Aug 2017 17:49:10 -0400 Subject: [PATCH v1] Work around w32-python-2.7 bug to fix prompt detection (Bug#21376) * lisp/progmodes/python.el (python-shell-prompt-detect): Don't put carriage returns into the temporary file when running in unbuffered mode, the w32 build of python 2.7 chokes on them. --- lisp/progmodes/python.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d774874a43..b7385f870f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2251,7 +2251,11 @@ python-shell-prompt-detect ;; `condition-case' and displaying the error message to ;; the user in the no-prompts warning. (ignore-errors - (let ((code-file (python-shell--save-temp-file code))) + (let ((code-file + ;; Python 2.7 on Windows does not handle + ;; carriage returns in unbuffered mode. + (let ((inhibit-eol-conversion (getenv "PYTHONUNBUFFERED"))) + (python-shell--save-temp-file code)))) ;; Use `process-file' as it is remote-host friendly. (process-file interpreter -- 2.14.1 --=-=-=--