Skip to content

Commit

Permalink
Trac #31063: Fix a test failure with readline 8.1
Browse files Browse the repository at this point in the history
readline 8.1 seems to print more escape characters in raw mode, which
causes a test failure in `misc/trace.py`

{{{
File "/usr/lib/python3.9/site-packages/sage/misc/trace.py", line 66, in
sage.misc.trace.trace
Failed example:
    print(s.before[s.before.find(b'--'):].decode())
Expected:
    --...
    ipdb> c
    2 * 5
Got:
    --Call--
    > <CSI-0;32m>/usr/lib/python3.9/site-packages/sage/arith/misc.py
<CSI-0m>(2422)<CSI-0;36m>factor<CSI-0;34m>()<CSI-0m>
    <CSI-0;32m>   2420 <CSI-0;31m><CSI-0;34m><CSI-0m><CSI-0m>
    <CSI-0m><CSI-0;32m>   2421 <CSI-0;31m><CSI-0;34m><CSI-0m><CSI-0m>
    <CSI-0m><CSI-0;32m>-> 2422 <CSI-0;31m><CSI-0;32m>def<CSI-0m> <CSI-
0m>factor<CSI-0m><CSI-0;34m>(<CSI-0m><CSI-0m>n<CSI-0m><CSI-0;34m>,<CSI-
0m> <CSI-0m>proof<CSI-0m><CSI-0;34m>=<CSI-0m><CSI-0;32m>None<CSI-
0m><CSI-0;34m>,<CSI-0m> <CSI-0m>int_<CSI-0m><CSI-0;34m>=<CSI-
0m><CSI-0;32m>False<CSI-0m><CSI-0;34m>,<CSI-0m> <CSI-0m>algorithm<CSI-
0m><CSI-0;34m>=<CSI-0m><CSI-0;34m>'pari'<CSI-0m><CSI-0;34m>,<CSI-0m>
<CSI-0m>verbose<CSI-0m><CSI-0;34m>=<CSI-0m><CSI-0;36m>0<CSI-
0m><CSI-0;34m>,<CSI-0m> <CSI-0;34m>**<CSI-0m><CSI-0m>kwds<CSI-
0m><CSI-0;34m>)<CSI-0m><CSI-0;34m>:<CSI-0m><CSI-0;34m><CSI-0m><CSI-0;34m
><CSI-0m><CSI-0m>
    <CSI-0m><CSI-0;32m>   2423 <CSI-0;31m>    """
    <CSI-0m><CSI-0;32m>   2424 <CSI-0;31m>    <CSI-0m>Return<CSI-0m>
<CSI-0m>the<CSI-0m> <CSI-0m>factorization<CSI-0m> <CSI-0m>of<CSI-
0m><CSI-0;31m> <CSI-0m><CSI-0;31m>`<CSI-0m><CSI-0;31m>`<CSI-0m><CSI-0m>n
<CSI-0m><CSI-0;31m>`<CSI-0m><CSI-0;31m>`<CSI-0m><CSI-0;34m>.<CSI-0m>
<CSI-0m>The<CSI-0m> <CSI-0m>result<CSI-0m> <CSI-0m>depends<CSI-0m> <CSI-
0m>on<CSI-0m> <CSI-0m>the<CSI-0m><CSI-0;34m><CSI-0m><CSI-0;34m><CSI-0m
><CSI-0m>
    <CSI-0m>
    <CSI-?2004h>ipdb> c
2 * 5CSI-?2004l>
    <BLANKLINE>
**********************************************************************
}}}

The `trace` command being tested here seems to work fine when run
manually.

URL: https://trac.sagemath.org/31063
Reported by: arojas
Ticket author(s): Antonio Rojas
Reviewer(s): Matthias Koeppe
  • Loading branch information
Release Manager committed Dec 27, 2020
2 parents f455241 + e294182 commit e63f65c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sage/misc/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def trace(code, preparse=True):
sage: print(s.before[s.before.find(b'--'):].decode())
--...
ipdb> c
2 * 5
...ipdb> c
...2 * 5...
Re-enable garbage collection::
Expand Down

0 comments on commit e63f65c

Please sign in to comment.