bugGNU Octave - Bugs: bug #45503, Saved function handles may be...


bug #45503: Saved function handles may be incorrect

Submitter:  asherikov <asherikov>
Submitted:  Thu 09 Jul 2015 03:41:29 PM UTC
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.8.1 Operating System:  * BSD
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 09 Jul 2015 05:16:09 PM UTC, comment #1: 

This is a known issue with saving function handles to subfunctions. Already reported as bug #36686, closing as a duplicate report.

Mike Miller <mtmiller>
Group Member
Thu 09 Jul 2015 03:41:29 PM UTC, original submission:  

If a script file contains many functions, they are not properly identified by their handles stored in a data file.

Example of a script file:
function test_struct = testfcn()
    test_struct.some_function_handle = @some_function;

function a = some_function()
    a = true;

It can be used as
a = testfcn();
a.some_function_handle(); % returns 'true'

However, after the structure 'a' was saved and loaded, the function handle is not restored properly
save a.mat a;
load a.mat;
a.some_function_handle(); % now calls 'testfcn()' instead of 'some_function()'

Contents of the data file:
# name: a
# type: scalar struct
# ndims: 2
 1 1
# length: 1
# name: some_function_handle
# type: function handle
# octaveroot: /usr/local
# path: /usr/home/aleks/testfcn.m

asherikov <asherikov>


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

Attach Files:

No files currently attached


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by asherikov (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-07-09 mtmiller StatusNone Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #36686

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code