Opened 4 years ago

Closed 4 years ago

#27619 closed enhancement (fixed)

py3: various fixes

Reported by: Frédéric Chapoton Owned by:
Priority: major Milestone: sage-8.8
Component: python3 Keywords:
Cc: Travis Scrimshaw, vklein Merged in:
Authors: Frédéric Chapoton Reviewers: Vincent Klein
Report Upstream: N/A Work issues:
Branch: d96e114 (Commits, GitHub, GitLab) Commit: d96e11461423003e3aaee5437e493a1fcc76a7f2
Dependencies: Stopgaps:

Status badges


after the switch to python 3.7.3

Change History (8)

comment:1 Changed 4 years ago by Frédéric Chapoton

Branch: u/chapoton/27619
Commit: 4e35d4977c8adfcd7b8042105aaec63c6df78cf7
Status: newneeds_review

New commits:

4e35d49py3: various fixes after switching to pythio 3.7.3

comment:2 Changed 4 years ago by Frédéric Chapoton

Cc: Travis Scrimshaw vklein added

green bot, please review

comment:3 Changed 4 years ago by vklein

The fixed test in is still failing :

File "src/sage/misc/", line 1026, in sage.misc.sagedoc.?
Failed example:
    print(search_src(" fetch(", "def", interact=False)) # py3
Exception raised:
    Traceback (most recent call last):
      File "/home/vklein/odk/sage/local/lib/python3.7/site-packages/sage/doctest/", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/vklein/odk/sage/local/lib/python3.7/site-packages/sage/doctest/", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.sagedoc.?[3]>", line 1, in <module>
        print(search_src(" fetch(", "def", interact=False)) # py3
      File "sage/misc/lazy_import.pyx", line 354, in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3690)
        return self.get_object()(*args, **kwds)
      File "/home/vklein/odk/sage/local/lib/python3.7/site-packages/sage/misc/", line 1109, in search_src
      File "/home/vklein/odk/sage/local/lib/python3.7/site-packages/sage/misc/", line 894, in _search_src_or_doc
        for lineno, line in enumerate(fobj)
      File "/home/vklein/odk/sage/local/lib/python3.7/site-packages/sage/misc/", line 895, in <listcomp>
        if, line, flags)]
      File "/home/vklein/odk/sage/local/lib/python3.7/", line 183, in search
        return _compile(pattern, flags).search(string)
      File "/home/vklein/odk/sage/local/lib/python3.7/", line 286, in _compile
        p = sre_compile.compile(pattern, flags)
      File "/home/vklein/odk/sage/local/lib/python3.7/", line 764, in compile
        p = sre_parse.parse(p, flags)
      File "/home/vklein/odk/sage/local/lib/python3.7/", line 930, in parse
        p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
      File "/home/vklein/odk/sage/local/lib/python3.7/", line 426, in _parse_sub
        not nested and not items))
      File "/home/vklein/odk/sage/local/lib/python3.7/", line 819, in _parse
        source.tell() - start)
    re.error: missing ), unterminated subpattern at position 6

We have seen similar cases where the exception seems to not be caught by the doctest framework in py3 but don't remember the fix right now.

comment:4 Changed 4 years ago by vklein

diff --git a/src/sage/misc/ b/src/sage/misc/
index a4f1818..df923b1 100644
--- a/src/sage/misc/
+++ b/src/sage/misc/
@@ -1026,7 +1026,7 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='',
         sage: print(search_src(" fetch(", "def", interact=False)) # py3
         Traceback (most recent call last):
-        ...error: missing ), unterminated subpattern at position 6
+        re.error: missing ), unterminated subpattern at position 6
     To fix this, *escape* the parenthesis with a backslash::

As the test is tagged with #3 this patch fix the problem even if i am not sure why ...error don't work in this case.

Version 0, edited 4 years ago by vklein (next)

comment:5 Changed 4 years ago by git

Commit: 4e35d4977c8adfcd7b8042105aaec63c6df78cf7d96e11461423003e3aaee5437e493a1fcc76a7f2

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

d96e114fix doctest in sagedoc

comment:6 Changed 4 years ago by Frédéric Chapoton

Voilà, voilà. Merci !

comment:7 Changed 4 years ago by vklein

Reviewers: Vincent Klein
Status: needs_reviewpositive_review

De rien.
Je valide le ticket.

comment:8 Changed 4 years ago by Volker Braun

Branch: u/chapoton/27619d96e11461423003e3aaee5437e493a1fcc76a7f2
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.