#12868: Attaching a pyx file in the presence of __init__.py results in wrong 
module
names
-------------------------+--------------------------------------------------
   Reporter:  SimonKing  |             Owner:  jason   
       Type:  defect     |            Status:  new     
   Priority:  major      |         Milestone:  sage-5.1
  Component:  misc       |          Keywords:          
Work issues:             |   Report Upstream:  N/A     
  Reviewers:             |           Authors:          
  Merged in:             |      Dependencies:          
   Stopgaps:             |  
-------------------------+--------------------------------------------------
 Create a new folder (say, /home/simon/SAGE/work/tests/) and create a file
 test.pyx with the content
 {{{
 class bla(type):
     pass
 }}}

 Start sage, attach the file, and you will find something like
 {{{
 sage: attach test.pyx
 Compiling ./test.pyx...
 sage: bla.__module__
 'sage: attach test.pyx
 Compiling ./test.pyx...
 sage: bla.__module__
 '_home_simon_SAGE_work_tests_test_pyx_0'
 }}}

 Then, create an `__init__.py` file in the same folder. You will find
 {{{
 sage: attach test.pyx
 Compiling ./test.pyx...
 sage: bla.__module__
 '_home_simon_SAGE_work_tests_test_pyx._home_simon_SAGE_work_tests_test_pyx_0'
 sage: sys.modules.has_key(bla.__module__)
 False
 }}}

 In fact, even if `__init__.py` is present, the module is still known under
 the "short" name, but the class doesn't know about it:
 {{{
 sage: import _home_simon_SAGE_work_tests_test_pyx_0
 sage: _home_simon_SAGE_work_tests_test_pyx_0.bla
 <class
 
'_home_simon_SAGE_work_tests_test_pyx._home_simon_SAGE_work_tests_test_pyx_0.bla'>
 }}}

 Please change the component if you think that there is one that fits less
 bad than "misc"...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12868>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to