#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 | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-----------------------------+----------------------------------------------
Comment (by leif):
Just checked: Imports in the attached file also work properly; the
imported modules also get the (temporary) package name prepended:
{{{
sage: attach("/tmp/foo/foo.pyx")
Note: Not ignoring /tmp/foo/__init__.py ...
Compiling /tmp/foo/foo.pyx...
Hello, I'm '/tmp/foo/__init__.py'.
sage: bar.__module__
'_tmp_foo_foo_pyx._tmp_foo_foo_pyx_0'
sage: sys.modules[bar.__module__]
<module '_tmp_foo_foo_pyx._tmp_foo_foo_pyx_0' from
'/home/leif/.sage//temp/sleepless/21279//spyx/_tmp_foo_foo_pyx/_tmp_foo_foo_pyx_0.so'>
sage: bar?
Type: classobj
String Form: _tmp_foo_foo_pyx._tmp_foo_foo_pyx_0.bar
Namespace: Interactive
Loaded File:
/home/leif/.sage/temp/sleepless/21279/spyx/_tmp_foo_foo_pyx/_tmp_foo_foo_pyx_0.so
Source File:
/home/leif/.sage/temp/sleepless/21279/spyx/_tmp_foo_foo_pyx/_tmp_foo_foo_pyx_0.so
sage: Baz?
Type: classobj
String Form: _tmp_foo_foo_pyx.baz.Baz
Namespace: Interactive
Loaded File:
/home/leif/.sage/temp/sleepless/21279/spyx/_tmp_foo_foo_pyx/baz.py
Source File:
/home/leif/.sage/temp/sleepless/21279/spyx/_tmp_foo_foo_pyx/baz.py
sage: Baz.__module__
'_tmp_foo_foo_pyx.baz'
sage: !cat /tmp/foo/foo.pyx
# foo.pyx
from baz import Baz
class bar:
pass
sage: !cat /tmp/foo/baz.py
# baz.py
class Baz:
pass
sage:
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12868#comment:15>
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.