Opened 2 years ago

Closed 2 years ago

#29428 closed defect (invalid)

Crash when trying to autocomplete

Reported by: mmasdeu Owned by:
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: cython Keywords: autocompletion, jedi, cython
Cc: vdelecroix, jdemeyer, embray, arojas Merged in:
Authors: Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Working with some custom modules that use cython, Sage crashes. Tracking it down, it appears that the source of the problem lies in the changes introduced in #24681.

The Jedi code tries to call get_source() and fails terribly because of that. I understand that #24681 tried to solve a problem, but the one it causes is much worse.

This is running Arch Linux with package sagemath 9.0-12, currently (2020/03/30) up to date.

Attachments (2)

Sage_crash_report.txt (136.6 KB) - added by mmasdeu 2 years ago.
Screen Shot 2020-04-25 at 11.39.23 AM.png (1.9 MB) - added by jhpalmieri 2 years ago.
screen shot after Et.<tab>

Change History (13)

comment:1 Changed 2 years ago by gh-mwageringel

  • Cc arojas added

@mmasdeu: Please provide a small example that leads to the problem. The main branch of Sage does not use jedi yet, so you could install Sage from source as a workaround.

Changed 2 years ago by mmasdeu

comment:2 Changed 2 years ago by mmasdeu

I uninstalled my extensions and it seems that the problem persists. Here is a MNWE:

sage: E = EllipticCurve('11a1')
sage: Et = E.tate_curve(11)
sage: Et.<TAB>

After this, nothing shows up. After a couple of seconds, Sage crashes. I attached the crash report.

comment:3 Changed 2 years ago by arojas

I have reverted #24681 in the Arch package. This will eventually hit sage-the-distro when ipython is upgraded, so a different solution needs to be found for the problem in #24681

comment:4 follow-up: Changed 2 years ago by jhpalmieri

I just installed IPython 7.13 and Jedi 0.17.0, and I don't see this problem. I'm still working out the kinks with the IPython installation, and in particular, the preparser seems to be broken: I get

sage: E = EllipticCurve('11a1')                                                           
sage: Et = E.tate_curve(11)                                                               
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-375b7dd9888b> in <module>
----> 1 Et = E.tate_curve(11)

...

AttributeError: 'int' object has no attribute 'is_prime'

But this works:

sage: E = EllipticCurve('11a1')
sage: Et = E.tate_curve(Integer(11))
sage: Et.<tab>

comment:5 Changed 2 years ago by jhpalmieri

I actually do see a problem, but not a crash. I'm attaching a screenshot after hitting Et.<tab>. (I'm trying this combined with #28197, not on its own.)

Changed 2 years ago by jhpalmieri

screen shot after Et.<tab>

comment:6 follow-up: Changed 2 years ago by mkoeppe

We had a similar problem with polymake/jupymake. Tab completion in IPython runs in a separate thread. This can break packages that are not prepared for threaded operation.

comment:7 in reply to: ↑ 6 Changed 2 years ago by mkoeppe

Replying to mkoeppe:

We had a similar problem with polymake/jupymake. Tab completion in IPython runs in a separate thread. This can break packages that are not prepared for threaded operation.

For reference: This happened in #22704, https://git.sagemath.org/sage.git/commit/?id=bcc7c6b88bb6c622988bf3b06579a5560c0181ee

comment:8 in reply to: ↑ 4 Changed 2 years ago by arojas

Replying to jhpalmieri:

I just installed IPython 7.13 and Jedi 0.17.0, and I don't see this problem.

I can confirm that this is fixed with jedi 0.17, specifically https://github.com/davidhalter/jedi/commit/e1425de8a437100601f312840d57cc0d4a10e264

So I guess this can be closed, since 0.16 will never be used in Sage.

comment:9 Changed 2 years ago by arojas

  • Milestone changed from sage-9.1 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

comment:10 Changed 2 years ago by jhpalmieri

  • Reviewers set to John Palmieri
  • Status changed from needs_review to positive_review

I don't really think we need reviewer names for tickets to be closed, but I'll enter my name anyway.

comment:11 Changed 2 years ago by chapoton

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.