GNU bug report logs - #24401
python-shell-completion-native-try returns incorrect results with python 3.5.2

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Fri, 9 Sep 2016 23:09:01 UTC

Severity: normal

Tags: fixed, patch

Merged with 22897, 28580, 30651

Found in versions 25.1, 25.1.50

Fixed in version 25.2

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24401 in the body.
You can then email your comments to 24401 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Fri, 09 Sep 2016 23:09:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit--Claudel <clement.pitclaudel <at> live.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 09 Sep 2016 23:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Cc: fgallina <at> gnu.org
Subject: python-shell-completion-native-try returns incorrect results with
 python 3.5.2
Date: Fri, 9 Sep 2016 19:07:54 -0400
[Message part 1 (text/plain, inline)]
Hi all,

Calling ‘run-python’ in ‘emacs -Q’ with ‘python-shell-interpreter’ set to "python3", I get the following warning:

    Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support
    readline, yet ‘python-shell-completion-native’ was t and "python3" is not
    part of the ‘python-shell-completion-native-disabled-interpreters’ list.
    Native completions have been disabled locally.

This warning is specific to Python 3 (it doesn't happen with Python 2.7). Additionally, the warning is spurious; native completion works fine.  This whole feature is new in Emacs 25.

The problem seems to be in

    (defun python-shell-completion-native-try ()
      "Return non-nil if can trigger native completion."
      (let ((python-shell-completion-native-enable t)
            (python-shell-completion-native-output-timeout
             python-shell-completion-native-try-output-timeout))
        (python-shell-completion-native-get-completions
         (get-buffer-process (current-buffer))
         nil "")))

The last call returns nil, apparently because ‘…-get-completions’ doesn't work with an empty input string in Python 3.5.2 with Emacs 25; however, if I change that last call as follows:

    (python-shell-completion-native-get-completions
     (get-buffer-process (current-buffer))
     nil "_")
          ^ add an underscore here, or another character that has completions

Then the warning message doesn't appear any more. Put more succinctly:

    Emacs 25, Python 2.7 (no warnings):

        Python 2.7.12 (default, Jul  1 2016, 15:12:24)
        [GCC 5.4.0 20160609] on linux2
        Type "help", "copyright", "credits" or "license" for more information.
        >>> python.el: native completion setup loaded

        (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) nil "")
        ⇒ ("and" "as" "assert" "break" "class" "continue" "def" "del" "elif" "else" "except" "exec" "finally" "for" "from" …)

        (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) nil "_")
        ⇒ ("__package__" "__PYTHON_EL_native_completion_setup" "__pyfile" "__name__" "__code" "__doc__" "__import__" "__debug__")

    Emacs 25, Python 3.5 (shows a warning):

        Python 3.5.2 (default, Jul  5 2016, 12:43:10)
        [GCC 5.4.0 20160609] on linux
        Type "help", "copyright", "credits" or "license" for more information.
        >>> python.el: native completion setup loaded

        (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) nil "")
        ⇒ nil ;; ← This is the bug

        (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) nil "_")
        ⇒ ("__name__" "__package__" "__spec__" "__PYTHON_EL_native_completion_setup" "__doc__" "__loader__" "__code" "__pyfile" "__build_class__" "__import__" "__debug__")

Can we add the suggested underscore?

Cheers,
Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Fri, 09 Sep 2016 23:31:02 GMT) Full text and rfc822 format available.

Message #8 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Fri, 9 Sep 2016 19:30:34 -0400
On Fri, Sep 9, 2016 at 7:07 PM, Clément Pit--Claudel
<clement.pitclaudel <at> live.com> wrote:
> Hi all,
>
> Calling ‘run-python’ in ‘emacs -Q’ with ‘python-shell-interpreter’ set to "python3", I get the following warning:
>
>     Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support
>     readline, yet ‘python-shell-completion-native’ was t and "python3" is not
>     part of the ‘python-shell-completion-native-disabled-interpreters’ list.
>     Native completions have been disabled locally.
>
> This warning is specific to Python 3 (it doesn't happen with Python 2.7). Additionally, the warning is spurious; native completion works fine.  This whole feature is new in Emacs 25.

I'm not familiar enough with Python tooling to say much about this,
but it seems similar (maybe identical) to #22897?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Sat, 10 Sep 2016 04:02:02 GMT) Full text and rfc822 format available.

Message #11 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Sat, 10 Sep 2016 00:00:31 -0400
[Message part 1 (text/plain, inline)]
On 2016-09-09 19:30, Noam Postavsky wrote:
> On Fri, Sep 9, 2016 at 7:07 PM, Clément Pit--Claudel 
> <clement.pitclaudel <at> live.com> wrote:
>> Hi all,
>> 
>> Calling ‘run-python’ in ‘emacs -Q’ with ‘python-shell-interpreter’
>> set to "python3", I get the following warning:
>> 
>> Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to
>> support readline, yet ‘python-shell-completion-native’ was t and
>> "python3" is not part of the
>> ‘python-shell-completion-native-disabled-interpreters’ list. Native
>> completions have been disabled locally.
>> 
>> This warning is specific to Python 3 (it doesn't happen with Python
>> 2.7). Additionally, the warning is spurious; native completion
>> works fine.  This whole feature is new in Emacs 25.
> 
> I'm not familiar enough with Python tooling to say much about this, 
> but it seems similar (maybe identical) to #22897?

You're right. Why do I never find these duplicates?
Does anyone object to the proposed fix?

Clément.

[signature.asc (application/pgp-signature, attachment)]

Merged 22897 24401. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 10 Sep 2016 12:32:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 27 Oct 2016 02:45:03 GMT) Full text and rfc822 format available.

Message #16 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Lukas Juhrich <lukasjuhrich <at> wh2.tu-dresden.de>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>,
 Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Thu, 27 Oct 2016 03:34:35 +0200
[Message part 1 (text/plain, inline)]
Hi,

On 10.09.2016 06:00, Clément Pit--Claudel wrote:
> Does anyone object to the proposed fix?
>
> Clément.
>

May I as a complete outsider to emacs development ask what the state
on this is?  To me it looks like this just hasn't been done yet.

If having a patch file makes things easier, there is one attached; Let
me know if I can help otherwise.


--
Sincerely,
Lukas Juhrich
[0001-Fix-Bug-24401-python-native-completion-warning.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 27 Oct 2016 03:37:01 GMT) Full text and rfc822 format available.

Message #19 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Lukas Juhrich <lukasjuhrich <at> wh2.tu-dresden.de>,
 Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Wed, 26 Oct 2016 23:35:57 -0400
[Message part 1 (text/plain, inline)]
Hi Lukas,

Thanks for the patch!

I prepared a similar one, but I didn't end up pushing it, because the bug has a more complex root cause.  Essentially, the issue is that completion doesn't work for empty strings in when python-shell-interpreter points to Python 3 (see also the original bug report, #22897).

A good way to experiment with this is to copy the completion code to a separate file (I attached it) and run python -i completion.py.  In python 2.7, pressing TAB shows a bunch of completions.  In 3.5, it just inserts a tab.

Can you help figure out why this happen?  Then we could fix the root of this bug.

Cheers,
Clément.

On 2016-10-26 21:34, Lukas Juhrich wrote:
> Hi,
> 
> On 10.09.2016 06:00, Clément Pit--Claudel wrote:
>> Does anyone object to the proposed fix?
>>
>> Clément.
>>
> 
> May I as a complete outsider to emacs development ask what the state
> on this is?  To me it looks like this just hasn't been done yet.
> 
> If having a patch file makes things easier, there is one attached; Let
> me know if I can help otherwise.
> 
> 
> --
> Sincerely,
> Lukas Juhrich
> 
[completion.py (text/x-python-script, attachment)]
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 27 Oct 2016 03:56:02 GMT) Full text and rfc822 format available.

Message #22 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Lukas Juhrich <lukasjuhrich <at> wh2.tu-dresden.de>,
 Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Wed, 26 Oct 2016 23:55:13 -0400
[Message part 1 (text/plain, inline)]
https://bugs.python.org/issue25660 might be related?

On 2016-10-26 21:34, Lukas Juhrich wrote:
> Hi,
> 
> On 10.09.2016 06:00, Clément Pit--Claudel wrote:
>> Does anyone object to the proposed fix?
>>
>> Clément.
>>
> 
> May I as a complete outsider to emacs development ask what the state
> on this is?  To me it looks like this just hasn't been done yet.
> 
> If having a patch file makes things easier, there is one attached; Let
> me know if I can help otherwise.
> 
> 
> --
> Sincerely,
> Lukas Juhrich
> 

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Sat, 29 Oct 2016 14:14:01 GMT) Full text and rfc822 format available.

Message #25 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Sat, 29 Oct 2016 10:12:54 -0400
[Message part 1 (text/plain, inline)]
On 2016-09-10 00:00, Clément Pit--Claudel wrote:
> On 2016-09-09 19:30, Noam Postavsky wrote:
>> On Fri, Sep 9, 2016 at 7:07 PM, Clément Pit--Claudel 
>> <clement.pitclaudel <at> live.com> wrote:
>>> Hi all,
>>>
>>> Calling ‘run-python’ in ‘emacs -Q’ with ‘python-shell-interpreter’
>>> set to "python3", I get the following warning:
>>>
>>> Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to
>>> support readline, yet ‘python-shell-completion-native’ was t and
>>> "python3" is not part of the
>>> ‘python-shell-completion-native-disabled-interpreters’ list. Native
>>> completions have been disabled locally.
>>>
>>> This warning is specific to Python 3 (it doesn't happen with Python
>>> 2.7). Additionally, the warning is spurious; native completion
>>> works fine.  This whole feature is new in Emacs 25.
>>
>> I'm not familiar enough with Python tooling to say much about this, 
>> but it seems similar (maybe identical) to #22897?
> 
> You're right. Why do I never find these duplicates?
> Does anyone object to the proposed fix?

If no one objects, I'll push the attached patch to master tomorrow (or should it go to emacs-25?)

Clément.
[0001-python.el-Fix-detection-of-native-completion-in-Pyth.patch (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Sat, 29 Oct 2016 14:35:01 GMT) Full text and rfc822 format available.

Message #28 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit--Claudel <clement.pit <at> gmail.com>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Sat, 29 Oct 2016 17:34:09 +0300
> From: Clément Pit--Claudel <clement.pit <at> gmail.com>
> Date: Sat, 29 Oct 2016 10:12:54 -0400
> 
> If no one objects, I'll push the attached patch to master tomorrow (or should it go to emacs-25?)

Can you tell when was the problem introduced?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Sat, 29 Oct 2016 15:04:02 GMT) Full text and rfc822 format available.

Message #31 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Sat, 29 Oct 2016 11:03:31 -0400
[Message part 1 (text/plain, inline)]
On 2016-10-29 10:34, Eli Zaretskii wrote:
>> From: Clément Pit--Claudel <clement.pit <at> gmail.com>
>> Date: Sat, 29 Oct 2016 10:12:54 -0400
>>
>> If no one objects, I'll push the attached patch to master tomorrow (or should it go to emacs-25?)
> 
> Can you tell when was the problem introduced?

The problem is new in Emacs 25: native completion is a new feature of python mode (2cb7592275bce47e44916134223b994a75e4b861).

Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Sat, 29 Oct 2016 15:09:01 GMT) Full text and rfc822 format available.

Message #34 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit--Claudel <clement.pit <at> gmail.com>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Sat, 29 Oct 2016 18:08:48 +0300
> Cc: 24401 <at> debbugs.gnu.org
> From: Clément Pit--Claudel <clement.pit <at> gmail.com>
> Date: Sat, 29 Oct 2016 11:03:31 -0400
> 
> On 2016-10-29 10:34, Eli Zaretskii wrote:
> >> From: Clément Pit--Claudel <clement.pit <at> gmail.com>
> >> Date: Sat, 29 Oct 2016 10:12:54 -0400
> >>
> >> If no one objects, I'll push the attached patch to master tomorrow (or should it go to emacs-25?)
> > 
> > Can you tell when was the problem introduced?
> 
> The problem is new in Emacs 25: native completion is a new feature of python mode (2cb7592275bce47e44916134223b994a75e4b861).

Then it should go to emacs-25.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Mon, 31 Oct 2016 12:39:02 GMT) Full text and rfc822 format available.

Message #37 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Mon, 31 Oct 2016 08:38:28 -0400
[Message part 1 (text/plain, inline)]
On 2016-10-29 11:08, Eli Zaretskii wrote:
> Then it should go to emacs-25.

Thanks; pushed!

Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Tue, 01 Nov 2016 00:30:01 GMT) Full text and rfc822 format available.

Message #40 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Clément Pit--Claudel <clement.pit <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Mon, 31 Oct 2016 20:30:16 -0400
Clément Pit--Claudel <clement.pit <at> gmail.com> writes:

> On 2016-10-29 11:08, Eli Zaretskii wrote:
>> Then it should go to emacs-25.
>
> Thanks; pushed!
>
> Clément.

Does that mean the bug is fixed?  Or is there still some "root cause" of
the bug to be found?




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 05 Nov 2016 01:59:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 24401 <at> debbugs.gnu.org and Clément Pit--Claudel <clement.pitclaudel <at> live.com> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 05 Nov 2016 01:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Sat, 05 Nov 2016 01:59:03 GMT) Full text and rfc822 format available.

Message #47 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Clément Pit--Claudel <clement.pit <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Fri, 04 Nov 2016 21:59:35 -0400
tags 24401 fixed
close 24401 25.2
quit

npostavs <at> users.sourceforge.net writes:

> Clément Pit--Claudel <clement.pit <at> gmail.com> writes:
>
>> On 2016-10-29 11:08, Eli Zaretskii wrote:
>>> Then it should go to emacs-25.
>>
>> Thanks; pushed!
>>
>> Clément.
>
> Does that mean the bug is fixed?

I'll assume yes.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Sat, 05 Nov 2016 03:29:02 GMT) Full text and rfc822 format available.

Message #50 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: Eli Zaretskii <eliz <at> gnu.org>, 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401: python-shell-completion-native-try returns incorrect
 results with python 3.5.2
Date: Fri, 4 Nov 2016 23:28:18 -0400
[Message part 1 (text/plain, inline)]
On 2016-11-04 21:59, npostavs <at> users.sourceforge.net wrote:
>> Does that mean the bug is fixed?
> 
> I'll assume yes.

Sorry about this! I missed your previous email. Yes was the correct answer :)

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Tue, 29 Nov 2016 16:52:02 GMT) Full text and rfc822 format available.

Message #53 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Tue, 29 Nov 2016 17:38:38 +0100
While trying out the latest pretest this issue doesn't seem to be fixed.

GNU Emacs 25.1.90.1 (x86_64-unknown-linux-gnu, X toolkit, Xawscrollbars) of 2016-11-29
Python 3.5.2

Steps to reproduce:

Start with emacs -Q and M-x run-python, the warning will still appear:

Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally.

Pressing TAB will also insert spaces instead of showing completions.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Tue, 29 Nov 2016 17:22:02 GMT) Full text and rfc822 format available.

Message #56 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#24401:
Date: Tue, 29 Nov 2016 12:21:33 -0500
[Message part 1 (text/plain, inline)]
On 2016-11-29 11:38, Davor Rotim wrote:
> While trying out the latest pretest this issue doesn't seem to be fixed.
> 
> GNU Emacs 25.1.90.1 (x86_64-unknown-linux-gnu, X toolkit, Xawscrollbars) of 2016-11-29
> Python 3.5.2
> 
> Steps to reproduce:
> 
> Start with emacs -Q and M-x run-python, the warning will still appear:
> 
> Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally.
> 
> Pressing TAB will also insert spaces instead of showing completions.

Thanks; I'll investigate this today.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Tue, 29 Nov 2016 20:28:01 GMT) Full text and rfc822 format available.

Message #59 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#24401:
Date: Tue, 29 Nov 2016 15:27:04 -0500
[Message part 1 (text/plain, inline)]
On 2016-11-29 12:21, Clément Pit--Claudel wrote:
> On 2016-11-29 11:38, Davor Rotim wrote:
>> While trying out the latest pretest this issue doesn't seem to be fixed.
>>
>> GNU Emacs 25.1.90.1 (x86_64-unknown-linux-gnu, X toolkit, Xawscrollbars) of 2016-11-29
>> Python 3.5.2
>>
>> Steps to reproduce:
>>
>> Start with emacs -Q and M-x run-python, the warning will still appear:
>>
>> Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally.
>>
>> Pressing TAB will also insert spaces instead of showing completions.

Hmm. I can't reproduce this here (I just built from the archive).  I start with

    $ src/emacs -Q --eval '(setq python-shell-interpreter "python3")'

Then I run 'M-x run-python (Python 3.5.2 (default, Nov 17 2016, 17:05:23))'; I don't get a warning.

Can you try `M-x find-function python-shell-completion-native-try' and confirm that it shows this:

(defun python-shell-completion-native-try ()
  "Return non-nil if can trigger native completion."
  (let ((python-shell-completion-native-enable t)
        (python-shell-completion-native-output-timeout
         python-shell-completion-native-try-output-timeout))
    (python-shell-completion-native-get-completions
     (get-buffer-process (current-buffer))
     nil "_")))
          ^ this is the important bit

Thanks!
Clément.


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Tue, 29 Nov 2016 20:42:01 GMT) Full text and rfc822 format available.

Message #62 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Tue, 29 Nov 2016 21:40:52 +0100
I started with:

emacs -Q --eval `(setq python-shell-interpreter "python3")'

then did `M-x run-python' and I was greeted by the same warning.

Tried `M-x find-function python-shell-completion-native-try' and the "_" addition is there.

http://i.imgur.com/rEDklpI.png




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Tue, 29 Nov 2016 22:36:02 GMT) Full text and rfc822 format available.

Message #65 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#24401:
Date: Tue, 29 Nov 2016 17:35:24 -0500
[Message part 1 (text/plain, inline)]
On 2016-11-29 15:40, Davor Rotim wrote:
> I started with:
> 
> emacs -Q --eval `(setq python-shell-interpreter "python3")'
> 
> then did `M-x run-python' and I was greeted by the same warning.
> 
> Tried `M-x find-function python-shell-completion-native-try' and the "_" addition is there.
> 
> http://i.imgur.com/rEDklpI.png

Hmm. Can you try the following? M-x run-python, then with the *Python* buffer current do (python-shell-completion-native-try).  Does this return a list of strings?

What about 

  (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) nil "imp")

Thanks!

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Wed, 30 Nov 2016 09:41:01 GMT) Full text and rfc822 format available.

Message #68 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Wed, 30 Nov 2016 10:39:59 +0100
Started with the following:

emacs -Q --eval '(setq python-shell-interpreter "python3")'
M-x run-python

Evaluation of (python-shell-completion-native-try):

http://i.imgur.com/VbBbxuy.png

Evaluation (python-shell-completion-native-get-completions (get-buffer-process (current-buffer)) nil "imp"):

http://i.imgur.com/ttABCyP.png

The same warning and errors also happen when I use "python2" as the interpreter so this is a bit strange.
This is on Arch Linux with python 3.5.2-3 and python 2.7.12-2 installed:

Python 3.5.2 (default, Nov  7 2016, 11:31:36)
[GCC 6.2.1 20160830] on linux

Python 2.7.12 (default, Nov  7 2016, 11:55:55)
[GCC 6.2.1 20160830] on linux2

Thank you for your patience.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Wed, 30 Nov 2016 14:23:01 GMT) Full text and rfc822 format available.

Message #71 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Davor Rotim <drot <at> firemail.cc>
Cc: 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401:
Date: Wed, 30 Nov 2016 09:22:10 -0500
On Wed, Nov 30, 2016 at 4:39 AM, Davor Rotim <drot <at> firemail.cc> wrote:

> The same warning and errors also happen when I use "python2" as the interpreter so this is a bit strange.
> This is on Arch Linux with python 3.5.2-3 and python 2.7.12-2 installed:

Also running Arch here (though my packages are a few months older),
you have to evaluate those expressions in the *Python* buffer, or else
you get those errors.

I'm not getting the warning here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Wed, 30 Nov 2016 15:10:02 GMT) Full text and rfc822 format available.

Message #74 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Wed, 30 Nov 2016 16:09:35 +0100
Evaluating both of those expressions in the *Python* buffer returns nil.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 01 Dec 2016 02:58:01 GMT) Full text and rfc822 format available.

Message #77 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#24401:
Date: Wed, 30 Nov 2016 21:57:14 -0500
[Message part 1 (text/plain, inline)]
On 2016-11-30 10:09, Davor Rotim wrote:
> Evaluating both of those expressions in the *Python* buffer returns nil.

I installed the release candidate in a clean Ubuntu VM, and I couldn't reproduce this.  Do you think you can you investigate this issue locally? 

Cheers,
Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 01 Dec 2016 08:48:01 GMT) Full text and rfc822 format available.

Message #80 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Thu, 01 Dec 2016 09:47:35 +0100
I think I have tracked down the issue.

I switched to another user and I was able to use `run-python' without any warnings.
Turns out it was my readline settings.
Bash 4.3 added a new readline feature: "set colored-stats on" which I had in .inputrc
Removing that line fixed my issue, I think this should be reproducible for all.

Once again thank you for your patience.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 01 Dec 2016 14:29:02 GMT) Full text and rfc822 format available.

Message #83 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#24401:
Date: Thu, 1 Dec 2016 09:28:16 -0500
[Message part 1 (text/plain, inline)]
On 2016-12-01 03:47, Davor Rotim wrote:
> I think I have tracked down the issue.
> 
> I switched to another user and I was able to use `run-python' without any warnings.
> Turns out it was my readline settings.
> Bash 4.3 added a new readline feature: "set colored-stats on" which I had in .inputrc
> Removing that line fixed my issue, I think this should be reproducible for all.
> 
> Once again thank you for your patience.

Wonderful! Do you know if there's a way we can disable this locally, for the Python subprocess?  Alternatively, do you want to contribute a patch that adds this hint to the warning shown if completion doesn't work?

Thanks!
Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 01 Dec 2016 20:24:02 GMT) Full text and rfc822 format available.

Message #86 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Thu, 01 Dec 2016 21:23:12 +0100
[Message part 1 (text/plain, inline)]
Luckily Readline has conditional constructs:

# .inputrc
$if Bash
set colored-stats on
$endif

This enables us to have color tab completion and avoid the bug with Emacs.
As for the alternative, I've provided a patch in the attachment.

Kind regards,

Davor Rotim
[python-warning-message.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 01 Dec 2016 20:41:02 GMT) Full text and rfc822 format available.

Message #89 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: drot <at> firemail.cc
Subject: Re: bug#24401:
Date: Thu, 1 Dec 2016 15:40:42 -0500
[Message part 1 (text/plain, inline)]
Thanks for the patch!

> +            "variable is conditionally enabled in your Readline init file. "
I would suggest conditionally "disabled", or simply "check the value of the … variable"

Can you provide the patch in Git format, so that I can commit it in your name? Eli, since this is documentation (just a comment), I guess it goes to emacs-25?

Clément.

On 2016-12-01 15:23, Davor Rotim wrote:
> Luckily Readline has conditional constructs:
> 
> # .inputrc
> $if Bash
> set colored-stats on
> $endif
> 
> This enables us to have color tab completion and avoid the bug with Emacs.
> As for the alternative, I've provided a patch in the attachment.
> 
> Kind regards,
> 
> Davor Rotim
> 

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 01 Dec 2016 21:31:02 GMT) Full text and rfc822 format available.

Message #92 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Thu, 01 Dec 2016 22:29:59 +0100
[Message part 1 (text/plain, inline)]
I think "conditionally disabled" is a better choice since it implies it
should be disabled in the first place.
I hope the attached patch is correct (emacs-25 branch).

Thanks,
Davor Rotim
[0001-Add-a-hint-to-the-warning-message-of-python-mode-to-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Thu, 01 Dec 2016 21:46:02 GMT) Full text and rfc822 format available.

Message #95 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: drot <at> firemail.cc
Subject: Re: bug#24401:
Date: Thu, 1 Dec 2016 16:45:13 -0500
[Message part 1 (text/plain, inline)]
Thanks a lot!  I'll wait for approval before pushing it.

On 2016-12-01 16:29, Davor Rotim wrote:
> I think "conditionally disabled" is a better choice since it implies it
> should be disabled in the first place.
> I hope the attached patch is correct (emacs-25 branch).
> 
> Thanks,
> Davor Rotim
> 

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Fri, 02 Dec 2016 07:23:02 GMT) Full text and rfc822 format available.

Message #98 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit--Claudel <clement.pit <at> gmail.com>
Cc: drot <at> firemail.cc, 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401:
Date: Fri, 02 Dec 2016 09:22:00 +0200
> From: Clément Pit--Claudel <clement.pit <at> gmail.com>
> Date: Thu, 1 Dec 2016 16:45:13 -0500
> Cc: drot <at> firemail.cc
> 
> Thanks a lot!  I'll wait for approval before pushing it.

If this is meant for the emacs-25 branch, then you have my approval.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Fri, 02 Dec 2016 16:33:01 GMT) Full text and rfc822 format available.

Message #101 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: drot <at> firemail.cc
Subject: Re: bug#24401:
Date: Fri, 2 Dec 2016 11:31:47 -0500
[Message part 1 (text/plain, inline)]
On 2016-12-01 03:47, Davor Rotim wrote:
> I think I have tracked down the issue.
> 
> I switched to another user and I was able to use `run-python' without any warnings.
> Turns out it was my readline settings.
> Bash 4.3 added a new readline feature: "set colored-stats on" which I had in .inputrc
> Removing that line fixed my issue, I think this should be reproducible for all.
> 
> Once again thank you for your patience.

Sorry; just before I push the fix to the warning message: are you sure this was the issue? When I set colored-stats on in my .inputrc, I do get colors in the terminal, but completion still works fine in Emacs.

Cheers,
Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Fri, 02 Dec 2016 17:15:01 GMT) Full text and rfc822 format available.

Message #104 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Fri, 02 Dec 2016 18:13:49 +0100
Happens with a new user if I have this in my .inputrc:

$include /etc/inputrc # tried also without this, same result
set colored-stats on

As soon as the line is removed or the variable is set to conditionally
disabled everything works again.

This was tested on:
GNU bash, version 4.4.5(1)-release (x86_64-unknown-linux-gnu)
Readline 7.0

There's no rush to merge the patch if someone else wants to test this.

Thanks,
Davor Rotim




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Fri, 02 Dec 2016 21:26:01 GMT) Full text and rfc822 format available.

Message #107 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pit <at> gmail.com>
To: Davor Rotim <drot <at> firemail.cc>, 24401 <at> debbugs.gnu.org
Subject: Re: bug#24401:
Date: Fri, 2 Dec 2016 16:24:48 -0500
[Message part 1 (text/plain, inline)]
On 2016-12-02 12:13, Davor Rotim wrote:
> Happens with a new user if I have this in my .inputrc:
> 
> $include /etc/inputrc # tried also without this, same result
> set colored-stats on
> 
> As soon as the line is removed or the variable is set to conditionally
> disabled everything works again.
> 
> This was tested on:
> GNU bash, version 4.4.5(1)-release (x86_64-unknown-linux-gnu)
> Readline 7.0
> 
> There's no rush to merge the patch if someone else wants to test this.

Indeed, I'd love some help testing this; I don't think the version of bash plays much of a role (since we're calling python directly), but the version of readline may.

On my machine, changing the .inputrc does change bash's behaviour, but it doesn't make a difference in Emacs' python shell (and so I don't get a warning).

Clément.


[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24401; Package emacs. (Fri, 02 Dec 2016 21:53:01 GMT) Full text and rfc822 format available.

Message #110 received at 24401 <at> debbugs.gnu.org (full text, mbox):

From: Davor Rotim <drot <at> firemail.cc>
To: Clément Pit Claudel <clement.pit <at> gmail.com>,
 24401 <at> debbugs.gnu.org
Subject: bug#24401
Date: Fri, 02 Dec 2016 22:51:51 +0100
So far I've got two people who could confirm this error happening on
their Arch Linux installs with Readline-7.0.
I think it's best not to pollute this bug report anymore and open a new
one to show awareness of the issue and to report further findings.

Kind regards,
Davor Rotim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 31 Dec 2016 12:24:05 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 28 Feb 2018 18:54:02 GMT) Full text and rfc822 format available.

Forcibly Merged 22897 24401 30651. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 28 Feb 2018 18:54:02 GMT) Full text and rfc822 format available.

Merged 22897 24401 28580 30651. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 28 Feb 2018 19:04:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Mar 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.