pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
707 stars 87 forks source link

anaconda-mode server: IndexError: list index out of range #368

Open Technologicat opened 4 years ago

Technologicat commented 4 years ago

Should service.py check that nodes_before is not empty? It seems it's not doing that, which may lead to the following crash of the anaconda-mode server:

anaconda_mode port 53427
127.0.0.1 - - [27/Sep/2019 09:40:30] ================================================================================
Traceback (most recent call last):
  File "/home/jjex06/.emacs.d/.cache/anaconda-mode/0.1.13/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 101, in apply
    result = method(**params)
  File "<ipython-input-1-8845c02a285e>", line 97, in wrapper
    result = f(jedi.Script(source, line, column, path, environment=virtual_environment))
  File "<ipython-input-1-8845c02a285e>", line 153, in eldoc
    signatures = script.call_signatures()
  File "/home/jjex06/.local/lib/python3.6/site-packages/jedi/api/__init__.py", line 369, in call_signatures
    helpers.get_call_signature_details(self._module_node, self._pos)
  File "/home/jjex06/.local/lib/python3.6/site-packages/jedi/api/helpers.py", line 239, in get_call_signature_details
    node.children[0], *_get_index_and_key(node.children, position))
  File "/home/jjex06/.local/lib/python3.6/site-packages/jedi/api/helpers.py", line 173, in _get_index_and_key
    if nodes_before[-1].type == 'arglist':
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jjex06/.emacs.d/.cache/anaconda-mode/0.1.13/service_factory-0.1.5-py3.6.egg/service_factory/providers/basehttp.py", line 40, in do_POST
    status, response = self.server.service(data)
  File "/home/jjex06/.emacs.d/.cache/anaconda-mode/0.1.13/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 50, in __call__
    result = self.apply(method, args)
  File "/home/jjex06/.emacs.d/.cache/anaconda-mode/0.1.13/service_factory-0.1.5-py3.6.egg/service_factory/service.py", line 105, in apply
    server_error(args['id'], error)
  File "/home/jjex06/.emacs.d/.cache/anaconda-mode/0.1.13/service_factory-0.1.5-py3.6.egg/service_factory/errors.py", line 91, in server_error
    raise ServiceException(500, dumps(response))
service_factory.exceptions.ServiceException: (500, '{"jsonrpc": "2.0", "id": 1, "error": {"code": -32000, "message": "Server error", "data": "IndexError(\'list index out of range\',)"}}')

My environment is Spacemacs develop #9637ceb3, Emacs 27.0.50 2019-08-20, Ubuntu 18.04.

Technologicat commented 4 years ago

Ah, here's also the *anaconda-response* buffer:

# status: nil
# point: 1

I have no *anaconda-socat* buffer.