Opened 7 months ago

Closed 7 months ago

#27619 closed enhancement (fixed)

py3: various fixes

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

Description

after the switch to python 3.7.3

Change History (8)

comment:1 Changed 7 months ago by chapoton

  • Branch set to u/chapoton/27619
  • Commit set to 4e35d4977c8adfcd7b8042105aaec63c6df78cf7
  • Status changed from new to needs_review

New commits:

4e35d49py3: various fixes after switching to pythio 3.7.3

comment:2 Changed 7 months ago by chapoton

  • Cc tscrim vklein added

green bot, please review

comment:3 Changed 7 months ago by vklein

The fixed test in sagedoc.py is still failing :

File "src/sage/misc/sagedoc.py", 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/forker.py", 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/forker.py", 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/sagedoc.py", line 1109, in search_src
        **kwds)
      File "/home/vklein/odk/sage/local/lib/python3.7/site-packages/sage/misc/sagedoc.py", 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/sagedoc.py", line 895, in <listcomp>
        if re.search(regexp, line, flags)]
      File "/home/vklein/odk/sage/local/lib/python3.7/re.py", line 183, in search
        return _compile(pattern, flags).search(string)
      File "/home/vklein/odk/sage/local/lib/python3.7/re.py", line 286, in _compile
        p = sre_compile.compile(pattern, flags)
      File "/home/vklein/odk/sage/local/lib/python3.7/sre_compile.py", line 764, in compile
        p = sre_parse.parse(p, flags)
      File "/home/vklein/odk/sage/local/lib/python3.7/sre_parse.py", line 930, in parse
        p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
      File "/home/vklein/odk/sage/local/lib/python3.7/sre_parse.py", line 426, in _parse_sub
        not nested and not items))
      File "/home/vklein/odk/sage/local/lib/python3.7/sre_parse.py", 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 7 months ago by vklein

diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py
index a4f1818..df923b1 100644
--- a/src/sage/misc/sagedoc.py
+++ b/src/sage/misc/sagedoc.py
@@ -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 #py3 this patch fix the problem even if i am not sure why ...error don't work in this case.

Last edited 7 months ago by vklein (previous) (diff)

comment:5 Changed 7 months ago by git

  • Commit changed from 4e35d4977c8adfcd7b8042105aaec63c6df78cf7 to d96e11461423003e3aaee5437e493a1fcc76a7f2

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

d96e114fix doctest in sagedoc

comment:6 Changed 7 months ago by chapoton

Voilà, voilà. Merci !

comment:7 Changed 7 months ago by vklein

  • Reviewers set to Vincent Klein
  • Status changed from needs_review to positive_review

De rien.
Je valide le ticket.

comment:8 Changed 7 months ago by vbraun

  • Branch changed from u/chapoton/27619 to d96e11461423003e3aaee5437e493a1fcc76a7f2
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.