Spyder: crash in 4.0.0b5 related to non-ascii characters and tooltips

Created on 23 Sep 2019  路  8Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [X] Searched the issues page for similar reports
  • [X] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [X] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [X] Could not reproduce inside jupyter qtconsole (if console-related)
  • [X] Tried basic troubleshooting (if a bug/error)

    • [X] Restarted Spyder

    • [X] Reset preferences with spyder --reset

    • [X] Reinstalled the latest version of Anaconda

    • [X] Tried the other applicable steps from the Troubleshooting Guide

  • [X] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

The program crashes as described below. It seems to be related to the non-ascii character in the function signature; when I tried replacing blah(位,x) with blah(w,x), everything works fine.

What steps reproduce the problem?

  1. Copy the following into a new python file, and save it:
# -*- coding: utf-8 -*-

def blah(位,x):
    return 位 + x

  1. On a new line, type "bla". The tooltip / autocomplete thing will prompt with the completion: blah(位,x).

  2. Press tab to accept this suggestion.

What is the expected output? What do you see instead?

It should fill in the missing letter "h" to make the word "blah". Instead, the program crashed.

Versions

  • Spyder version: 4.0.0b5
  • Python version: 3.7.4 64-bit
  • Qt version: 5.9.6
  • PyQt version: 5.9.2
  • Operating System name/version: Windows 10

Dependencies

cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.4.2 (OK)
qtconsole >=4.5.5            :  4.5.5 (OK)
nbconvert >=4.0              :  5.5.0 (OK)
sphinx >=0.6.6               :  2.1.2 (OK)
pylint >=0.25                :  2.3.1 (OK)
psutil >=0.3                 :  5.6.3 (OK)
qtawesome >=0.5.7            :  0.5.7 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
zmq >=17                     :  18.1.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
spyder_kernels >=1.5.0;<2.0.0:  1.5.0 (OK)
qdarkstyle >=2.7             :  2.7 (OK)
atomicwrites >=1.2.0         :  1.3.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
watchdog                     :  None (OK)
keyring                      :  None (OK)
pexpect >=4.4.0              :  4.7.0 (OK)
pympler                      :  None (OK)
sympy >=0.7.3                :  None (NOK)
cython >=0.21                :  None (NOK)
IPython >=4.0                :  7.8.0 (OK)
matplotlib >=2.0.0           :  3.1.0 (OK)
pandas >=0.13.1              :  0.25.0 (OK)
numpy >=1.7                  :  1.16.4 (OK)
scipy >=0.17.0               :  1.3.1 (OK)
pyls >=0.28.2;<0.29.0        :  0.28.3 (OK)
rtree >=0.8.3                :  0.8.3 (OK)

Windows Code Completion Bug

All 8 comments

What was the error?

The Spyder app freezes. When I close it from Windows I get the usual error message: "Python has stopped responding..." and you can choose "Close the program" or "Wait for the program to respond".

Does that answer your question?

Yes, thanks

@dalthviz could you test this?

I can't reproduce this on master with ubuntu

I handle to reproduce this on Windows. It seems like is related with the snippets functionality. After forcefully quitting the crashed Spyder instance while using SPYDER_DEBUG=3 I get:

Handling signal: 0
Traceback (most recent call last):
  File "C:\Users\Daniel\Documents\Spyder\spyder\spyder\plugins\editor\extensions\snippets.py", line 758, in insert_snippet
    ast = build_snippet_ast(text)
  File "C:\Users\Daniel\Documents\Spyder\spyder\spyder\utils\snippets\ast.py", line 127, in build_snippet_ast
    tokens = tokenize(snippet_text)
  File "C:\Users\Daniel\Documents\Spyder\spyder\spyder\utils\snippets\lexer.py", line 90, in tokenize
    regex = token_regex[token_name]

@goanpeca should I fix this or this should be address with the PR @andfoy is working on?

@goanpeca should I fix this or this should be address with the PR @andfoy is working on?

@andfoy can you reproduce this and fix it?

If @andfoy can reproduce it, then he could fix it as part of that PR, otherwise you could do it on a separate one. Let's wait for his answer :-)

@dalthviz, please test PR #10256. @andfoy's last change there should fix this problem.

@ccordoba12 after testing PR https://github.com/spyder-ide/spyder/pull/10256 Spyder doesn't hang but the symbols are encoded incorrectly:

csu

Was this page helpful?
0 / 5 - 0 ratings