Opened 20 months ago
Closed 20 months ago
#28138 closed defect (fixed)
py3: misc/dev_tools.py
Reported by: | jhpalmieri | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.9 |
Component: | python3 | Keywords: | |
Cc: | Merged in: | ||
Authors: | John Palmieri | Reviewers: | Frédéric Chapoton |
Report Upstream: | N/A | Work issues: | |
Branch: | 6fc715d (Commits, GitHub, GitLab) | Commit: | 6fc715d18e21a6169c3f949f0e92e60fcd80003a |
Dependencies: | Stopgaps: |
Description (last modified by )
The file misc/dev_tools.py
has a Python 3 doctest failure:
File "src/sage/misc/dev_tools.py", line 160, in sage.misc.dev_tools.load_submodules Failed example: sage.misc.dev_tools.load_submodules(sage.combinat) Expected nothing Got: load sage.combinat.designs.orthogonal_arrays_find_recursive...failed
This comes from this block:
except (ValueError, AttributeError, TypeError, ImportError): # we might get error because of cython code that has been # compiled but with source removed sys.stdout.write("failed\n")
If I add a raise
command at the end of this, I see
sage: sage.misc.dev_tools.load_submodules(sage.combinat) load sage.combinat.algebraic_combinatorics... succeeded ... load sage.combinat.designs.orthogonal_arrays_find_recursive...failed --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-d8b886cdfe68> in <module>() ----> 1 sage.misc.dev_tools.load_submodules(sage.combinat) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/misc/dev_tools.py in load_submodules(module, exclude_pattern) 198 sys.stdout.flush() 199 loader = importer.find_module(module_name) --> 200 loader.load_module(module_name) 201 sys.stdout.write(" succeeded\n") 202 except (ValueError, AttributeError, TypeError, ImportError): /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap_external.py in _check_name_wrapper(self, name, *args, **kwargs) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap_external.py in load_module(self, fullname) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap_external.py in load_module(self, fullname) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap.py in _load_module_shim(self, fullname) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap.py in _load(spec) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap_external.py in exec_module(self, module) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds) /Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx in init sage.combinat.designs.orthogonal_arrays_find_recursive (build/cythonized/sage/combinat/designs/orthogonal_arrays_find_recursive.c:13225)() 798 # Associates to n the list of k,x with x>1 such that there exists an 799 # OA(k,n+x)-OA(k,x). Useful in find_brouwer_separable_design --> 800 cdef dict _QDM = sage.combinat.designs.database.QDM 801 cdef dict ioa_indexed_by_n_minus_x = {} 802 for x in _QDM.itervalues(): AttributeError: module 'sage.combinat.designs' has no attribute 'database'
I don't know why this fails. A related mystery: in a fresh Sage session:
sage: sage.misc.dev_tools.load_submodules(sage.combinat) ... sage: sage: sage.combinat.designs.database --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-2-218d9965f21f> in <module>() ----> 1 sage.combinat.designs.database AttributeError: module 'sage.combinat.designs' has no attribute 'database' sage: import sage.combinat.designs.database sage: sage.combinat.designs.database --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-218d9965f21f> in <module>() ----> 1 sage.combinat.designs.database AttributeError: module 'sage.combinat.designs' has no attribute 'database'
whereas if you restart Sage and skip the first line:
sage: sage.combinat.designs.database --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-218d9965f21f> in <module>() ----> 1 sage.combinat.designs.database AttributeError: module 'sage.combinat.designs' has no attribute 'database' sage: import sage.combinat.designs.database sage: sage.combinat.designs.database <module 'sage.combinat.designs.database' from '/Users/jpalmier/Desktop/Sage/sage_builds/PYTHON3/sage-8.9.beta1/local/lib/python3.7/site-packages/sage/combinat/designs/database.py'>
Change History (5)
comment:1 Changed 20 months ago by
- Description modified (diff)
comment:2 Changed 20 months ago by
- Branch set to u/jhpalmieri/misc-dev-tools
comment:3 Changed 20 months ago by
- Commit set to 6fc715d18e21a6169c3f949f0e92e60fcd80003a
- Status changed from new to needs_review
comment:4 Changed 20 months ago by
- Reviewers set to Frédéric Chapoton
- Status changed from needs_review to positive_review
Probably caused by #27916
The fix looks good
comment:5 Changed 20 months ago by
- Branch changed from u/jhpalmieri/misc-dev-tools to 6fc715d18e21a6169c3f949f0e92e60fcd80003a
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
I don't understand what's going on, but this branch seems to fix the problem.
New commits:
trac 28138: fix py3 doctest in misc/dev_tools.py