Opened 9 years ago

Closed 9 years ago

#16050 closed enhancement (fixed)

miscellaneous cleanup/bugfixes for sage.misc.interpreter and sage.misc.sage_extension

Reported by: ohanar Owned by:
Priority: major Milestone: sage-6.2
Component: misc Keywords:
Cc: jason Merged in:
Authors: R. Andrew Ohana Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: 12efdd3 (Commits, GitHub, GitLab) Commit: 12efdd3b2658c881944b48d25a637112bc5ed268
Dependencies: Stopgaps:

GitHub link to the corresponding issue

Description (last modified by ohanar)

This is just a bit of cleanup+bugfixes that I've done over the past couple weeks. Notable changes:

  • remove deprecations from #12719
  • fix iload to actually be able to edit the loaded lines (could still be better, but would require more hacking on ipython internals; probably should just be added to upstream ipython instead)
  • fix weird random bugs encountered with InterfaceShellTransformer (e.g. in gap, creating an error will cause future valid lines to error out) -- as far as I can tell, the code was just overthought (and had interface specific things that should belong as part of the appropriate interface)
  • use the IPython shutdown hook rather than customizing ask_exit
  • remove some dead and unused code
  • start migrating files out of sage.misc and into sage.repl

Change History (18)

comment:1 Changed 9 years ago by ohanar

I would also like to move most of this code out of sage.misc to something like sage.app, but I'm not really happy with that package name. Maybe something like sage.terminal? Suggestions would be welcome.

Also, this is just a first step towards cleanup. Certainly more could be done (e.g. stuff surrounding the preparser), but I figured may as well do this gradually rather than as a patchbomb.

comment:2 in reply to:  1 ; Changed 9 years ago by mmezzarobba

Replying to ohanar:

I would also like to move most of this code out of sage.misc to something like sage.app, but I'm not really happy with that package name. Maybe something like sage.terminal? Suggestions would be welcome.

sage.shell? sage.toplevel? sage.repl?

comment:3 in reply to:  2 Changed 9 years ago by ohanar

Replying to mmezzarobba:

sage.shell? sage.toplevel? sage.repl?

ooh, I like sage.repl :)

comment:4 Changed 9 years ago by git

Commit: 4e5822efd20aa702173c2a19fb921de196157de364479d9e2bee27b5f6ba52a3386e030af43e487f

Branch pushed to git repo; I updated commit sha1. New commits:

64479d9start migrating stuff over to sage.repl

comment:5 Changed 9 years ago by ohanar

Description: modified (diff)

comment:6 Changed 9 years ago by git

Commit: 64479d9e2bee27b5f6ba52a3386e030af43e487f9324deb05dbe6fae032d5bbca09e91810696a39d

Branch pushed to git repo; I updated commit sha1. New commits:

3f8db78derp: forgot to add file
9324debMerge 6.2.beta7 into terminal_app_cleanup

comment:7 Changed 9 years ago by git

Commit: 9324deb05dbe6fae032d5bbca09e91810696a39d542dcc9483b8c19be96971512374f3437473cdcf

Branch pushed to git repo; I updated commit sha1. New commits:

dae1e70fix documentation
542dcc9fix a couple bugs from relocation

comment:8 Changed 9 years ago by git

Commit: 542dcc9483b8c19be96971512374f3437473cdcf861878435bfeef667669325deca252b5823029f0

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

bfaf87afix documentation
8618784fix a couple bugs from relocation

comment:9 Changed 9 years ago by ohanar

(Sorry for the force push, didn't properly copy a symlink.)

I'll make further changes in future tickets (I'll of course fix any regressions here, if they are found), so I'm marking this as needs review.

comment:10 Changed 9 years ago by ohanar

Status: newneeds_review

comment:11 Changed 9 years ago by vbraun

Reviewers: Volker Braun

comment:12 Changed 9 years ago by vbraun

Conflicts with the already-merged (but not released) #15990.

From looking at the source it seems that this still suffers from the same problem as #16154, the sage prompt transformer ought to run first and not last. Can you fix it here, then I'll close my ticket.

comment:13 Changed 9 years ago by git

Commit: 861878435bfeef667669325deca252b5823029f0df49c8e619080b506d7ac0c2b6a3e0e1ce85e27b

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

eb09160trac #11726 implement floordiv for laurent polys in one variable
e27a420trac #11726 one failing doctest corrected
ba866efMerge branch 'public/ticket/11726' into raise-plus
86261b1Improve count_points
55cdcf3Refactor point counting code for hyperelliptic curves.
fc7a569First bunch of fixes and missing examples.
63bf717Rebase on top of #15108.
8029bc6Merge remote-tracking branch 'trac/develop' into ticket/15148
136948aMerge branch 'u/jpflori/ticket/15148' into raise-plus
df49c8eMerge remote-tracking branch 'trac/u/wluebbe/ticket/15990b' into terminal_app_cleanup

comment:14 Changed 9 years ago by ohanar

ok, I added your fix for #16154 and merged in #15990.

comment:15 Changed 9 years ago by vbraun

Can you also fix the module path in the doctests? ;-)

sage -t --long src/sage/repl/ipython_extension.py
**********************************************************************
File "src/sage/repl/ipython_extension.py", line 78, in sage.repl.ipython_extension.SageMagics.crun
Failed example:
    from sage.misc.interpreter import get_test_shell
Exception raised:
    Traceback (most recent call last):
      File "/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run
        self.execute(example, compiled, test.globs)
      File "/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute
        exec compiled in globs
      File "<doctest sage.repl.ipython_extension.SageMagics.crun[0]>", line 1, in <module>
        from sage.misc.interpreter import get_test_shell
    ImportError: cannot import name get_test_shell
**********************************************************************
File "src/sage/repl/ipython_extension.py", line 79, in sage.repl.ipython_extension.SageMagics.crun
Failed example:
    shell = get_test_shell()
Exception raised:
    Traceback (most recent call last):
      File "/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 480, in _run
        self.execute(example, compiled, test.globs)
      File "/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 839, in execute
        exec compiled in globs
      File "<doctest sage.repl.ipython_extension.SageMagics.crun[1]>", line 1, in <module>
        shell = get_test_shell()
    NameError: name 'get_test_shell' is not defined
**********************************************************************
1 item had failures:

comment:16 Changed 9 years ago by vbraun

Branch: u/ohanar/terminal_app_cleanupu/vbraun/terminal_app_cleanup

comment:17 Changed 9 years ago by vbraun

Commit: df49c8e619080b506d7ac0c2b6a3e0e1ce85e27b12efdd3b2658c881944b48d25a637112bc5ed268

Fixed


New commits:

12efdd3fix crun doctest

comment:18 Changed 9 years ago by vbraun

Branch: u/vbraun/terminal_app_cleanup12efdd3b2658c881944b48d25a637112bc5ed268
Resolution: fixed
Status: needs_reviewclosed
Note: See TracTickets for help on using tickets.