#15175: python inspect inconsistency
-------------------------------------+-------------------------------------
   Reporter:  felixs                 |            Owner:
       Type:  enhancement            |           Status:  new
   Priority:  minor                  |        Milestone:  sage-5.12
  Component:  build                  |         Keywords:
  Merged in:                         |          Authors:  Felix Salfelder
  Reviewers:                         |  Report Upstream:  N/A
Work issues:                         |           Branch:
     Commit:                         |  u/felixs/dynamic_class
  d6ebe88fbc93daaa3e41531775a2f064eae3a1b3|     Dependencies:
   Stopgaps:                         |
-------------------------------------+-------------------------------------
 I have discovered weird behaviour while debugging a doctest in
 dynamic_class.py. A minimal example looks like this:

 {{{
 $ ./sage -t src/sage/structure/dynamic_class.py
 [..]
 passed!
 [..]
 $ touch local/lib/python2.7/site-packages/sage/structure/dynamic_class.py
 $ ./sage -t src/sage/structure/dynamic_class.py
 [..]
     inspect.getfile(Foo2)
 Expected:
     '.../sage/structure/dynamic_class.pyc'
 Got:
     '.../local/lib/python2.7/site-
 packages/sage/structure/dynamic_class.py'
 [..]
 }}}

 The reason is, that py_compile.compile() produces bytecode different
 from what a python call silently creates (other than that, there _seems_
 to be no difference).

 Now in general, there is nothing wrong with silently generated pyc
 files, so imo there shouldn't be a problem in this case.

 The simplest solution would be just expecting
 {{{
     '.../sage/structure/dynamic_class.py...',
 }}}
 instead, as this will not only pass the test, but also documents the
 randomness.
 Is there anything else within the sage library that relies on one or the
 other outcome of a getfile call?

--
Ticket URL: <http://trac.sagemath.org/ticket/15175>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to