bugGNU Octave - Bugs: bug #39141, saved objects of user created...

 
 

bug #39141: saved objects of user created class fail to load without explicitly loading constructor

Submitter:  None
Submitted:  Sun 02 Jun 2013 11:42:37 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Willem Atsma Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 24 Nov 2016 11:45:11 PM UTC, comment #3: 

my message was cropped

after: "now start octave and do " comes


octave-gui:1> load q.txt
warning: no constructor for class quaternion
octave-gui:2> load q_v7.mat
warning: no constructor for class quaternion
warning: load: element has been converted to a structure


Juan Pablo Carbajal <juanpi>
Group Member
Thu 24 Nov 2016 11:43:59 PM UTC, comment #2: 

Still present in 4.2.0


pkg load quaternion
q = quaternion(1,1,1)
save("-text","q.txt","q")
save("-v7","q_v7.mat","q")
exit


now start octave and do


octave-gui:1> load q.txt
warning: no constructor for class quaternion
octave-gui:2> load q_v7.mat
warning: no constructor for class quaternion
warning: load: element has been converted to a structure
--verbatim

Juan Pablo Carbajal <juanpi>
Group Member
Sun 28 Jul 2013 04:10:26 PM UTC, comment #1: 

Confirmed with both quaternion() and gf(). I suspect this may have to do with the way types are registered with the Octave interpreter. Typically the constructor function registers the type on the first call, so this error may be due to that expected sequence not happening.

Mike Miller <mtmiller>
Group Member
Sun 02 Jun 2013 11:42:37 PM UTC, original submission:  

To reproduce:
 - create an object of a class (e.g. "quaternion")
 - save object to file
 - exit octave
 - start octave
 - load file

I created a custom object "transform" which has a data member "quaternion" (from the forge package) and ran into this behaviour. If I call the constructor before attempting to load the file it works as it should.


octave:1> default_save_options ('-text')
octave:2> load test.txt
error: Invalid call to quaternion.  Correct usage is:

 -- Function File: Q = quaternion (W)
 -- Function File: Q = quaternion (X, Y, Z)
 -- Function File: Q = quaternion (W, X, Y, Z)


warning: call to constructor for class quaternion failed


Similarly when I load a single "transform" saved in the matlab binary format:


octave:1> default_save_options
ans = -mat7-binary
octave:2> load test.mat
error: Invalid call to quaternion.  Correct usage is:

 -- Function File: Q = quaternion (W)
 -- Function File: Q = quaternion (X, Y, Z)
 -- Function File: Q = quaternion (W, X, Y, Z)


warning: call to constructor for class quaternion failed
warning: load: element has been converted to a structure
warning: call to constructor for class transform failed
warning: load: element has been converted to a structure


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-28 mtmiller CategoryNone Libraries
        Item GroupNone Incorrect Result
        StatusNone Confirmed
        Release3.6.4 dev
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code