Ticket #5533 (new defect)

Opened 4 years ago

Last modified 4 years ago

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

junk7.spyx Download (113 bytes) - added by rhinton 4 years ago.
Defines a dummy class for pickling/unpickling test

Change History

Changed 4 years ago by rhinton

Defines a dummy class for pickling/unpickling test

comment:1 Changed 4 years ago by mabshoff

  • Milestone set to sage-4.0
Note: See TracTickets for help on using tickets.