Ticket #5533 (new defect)
Recompiling .spyx files changes class
| Reported by: | rhinton | Owned by: | cwitty |
|---|---|---|---|
| Priority: | major | Milestone: | sage-5.10 |
| Component: | misc | Keywords: | |
| Cc: | cwitty | Work issues: | |
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
Apparently, recompiling a .spyx file creates a new module and/or creates a new dummy class. This gets in the way of pickling. For example, start from a command prompt and follow the instructions using the attached junk7.spyx.
sage # at the command prompt, start Sage
sage: load 'junk7.spyx'
sage: # make an insignificant change to junk7.spyx so it will recompile...
sage: load 'junk7.spyx'
sage: MyClass().greet()
Greetings!
sage: import pickle
sage: fi = file('junk7.pjr', 'w')
sage: pickle.dump(MyClass(), fi)
sage: fi.close()
sage: exit # returns to the command line
sage # now restart sage from the command line
sage: load 'junk7.spyx'
sage: import pickle
sage: fi = file('junk7.pjr', 'r')
sage: tmp = pickle.load(fi)
---------------------------------------------------------------------------
ImportError
...
ImportError: No module named _home_ryan_uva_prng_well_sage_junk7_spyx_1
So the error is trying to import the module. Apparently compiling a .spyx file creates a new Python module each time? Other than exiting Sage every time I want to recompile, I don't see a way around this problem -- or a way to fix it.
Attachments
Change History
Changed 4 years ago by rhinton
-
attachment
junk7.spyx
added
Note: See
TracTickets for help on using
tickets.

Defines a dummy class for pickling/unpickling test