bugGNU Octave - Bugs: bug #38555, Strange behaviour of nargout

 
 

bug #38555: Strange behaviour of nargout

Submitter:  None
Submitted:  Wed 20 Mar 2013 02:13:09 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Peter Søndergaard Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.3
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 20 Mar 2013 09:14:47 PM UTC, comment #3: 

Confirmed on the stable branch.  The problem has already been fixed on the development branch and is unlikely to be backported.  I would suggest building from Mercurial development sources or waiting for the next major release of Octave (3.8.0 or 4.0.0).

Rik <rik5>
Group administrator
Wed 20 Mar 2013 08:13:31 PM UTC, comment #2: 

Here is the example again. In a freshly started Octave:

octave:1> nargout("sombrero")
error: nargout: invalid function
octave:1> sombrero;
octave:2> nargout("sombrero")
ans =  3

So the nargout function only works correctly after the sombrero function has been called once. This works the same way for other .m files


Anonymous
Wed 20 Mar 2013 05:08:54 PM UTC, comment #1: 

Your example seems to be missing from the bug report.  Could you re-post the sample code necessary to see the bug?

Rik <rik5>
Group administrator
Wed 20 Mar 2013 02:13:09 PM UTC, original submission:  

There is an option of nargout to call it with the name of a function, and then it returns the number of optional output arguments of that function. However, if that function has not been called before in the current Octave session, nargout will fail to find the function.

Steps to reproduce:

In a freshly started Octave, type:


octave:1> nargout("sombrero")
error: nargout: invalid function

-verbatim
Calling the sombrero function and trying again fixes the problem:
+verbatim+
octave:1> sombrero
octave:2> nargout("sombrero")
ans =  3


I am using Octave 3.6.3 on x86_64-redhat-linux-gnu

I think this is related to the work discussed here:
http://savannah.gnu.org/bugs/?func=detailitem&item_id=32700

Cheers,
Peter.


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 rik5 (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-03-20 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code