unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24401: python-shell-completion-native-try returns incorrect results with python 3.5.2
@ 2016-09-09 23:07 Clément Pit--Claudel
  2016-09-09 23:30 ` Noam Postavsky
                   ` (9 more replies)
  0 siblings, 10 replies; 34+ messages in thread
From: Clément Pit--Claudel @ 2016-09-09 23:07 UTC (permalink / raw)
  To: 24401


[-- Attachment #1.1: Type: text/plain, Size: 3054 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2016-12-02 21:51 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-09 23:07 bug#24401: python-shell-completion-native-try returns incorrect results with python 3.5.2 Clément Pit--Claudel
2016-09-09 23:30 ` Noam Postavsky
2016-09-10  4:00   ` Clément Pit--Claudel
2016-10-27  1:34     ` Lukas Juhrich
2016-10-27  3:35       ` Clément Pit--Claudel
2016-10-27  3:55       ` Clément Pit--Claudel
2016-10-29 14:12     ` Clément Pit--Claudel
2016-10-29 14:34       ` Eli Zaretskii
2016-10-29 15:03         ` Clément Pit--Claudel
2016-10-29 15:08           ` Eli Zaretskii
2016-10-31 12:38             ` Clément Pit--Claudel
2016-11-01  0:30               ` npostavs
2016-11-05  1:59                 ` npostavs
2016-11-05  3:28                   ` Clément Pit--Claudel
2016-11-29 16:38 ` bug#24401: Davor Rotim
2016-11-29 17:21   ` bug#24401: Clément Pit--Claudel
2016-11-29 20:27     ` bug#24401: Clément Pit--Claudel
2016-11-29 20:40 ` bug#24401: Davor Rotim
2016-11-29 22:35   ` bug#24401: Clément Pit--Claudel
2016-11-30  9:39 ` bug#24401: Davor Rotim
2016-11-30 14:22   ` bug#24401: Noam Postavsky
2016-11-30 15:09 ` bug#24401: Davor Rotim
2016-12-01  2:57   ` bug#24401: Clément Pit--Claudel
2016-12-01  8:47 ` bug#24401: Davor Rotim
2016-12-01 14:28   ` bug#24401: Clément Pit--Claudel
2016-12-02 16:31   ` bug#24401: Clément Pit--Claudel
2016-12-01 20:23 ` bug#24401: Davor Rotim
2016-12-01 20:40   ` bug#24401: Clément Pit--Claudel
2016-12-01 21:29 ` bug#24401: Davor Rotim
2016-12-01 21:45   ` bug#24401: Clément Pit--Claudel
2016-12-02  7:22     ` bug#24401: Eli Zaretskii
2016-12-02 17:13 ` bug#24401: Davor Rotim
2016-12-02 21:24   ` bug#24401: Clément Pit--Claudel
2016-12-02 21:51 ` bug#24401: Davor Rotim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).