bugGNU Octave - Bugs: bug #34128, str2num does not return empty...

 
 

bug #34128: str2num does not return empty correctly, but errors out

Submitter:  Ben Barrowes <barrowes>
Submitted:  Thu 25 Aug 2011 12:25:16 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Works For Me Assigned to:  None
Originator Name:  barrowes Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 18 Sep 2011 10:46:14 PM UTC, comment #2: 

As this is working in the current sources, I'm closing this report.

It can be reopened if needed.

Ben Abbott <bpabbott>
Group Member
Thu 01 Sep 2011 04:09:46 PM UTC, comment #1: 

I'm running the stable branch (3.4.x series) just compiled using the developers sources.

It appears this has been fixed by the changeset below.


>> str2num('1+2*a')
ans = [](0x0)


http://hg.savannah.gnu.org/hgweb/octave/rev/0c74237b3479

Ben Abbott <bpabbott>
Group Member
Thu 25 Aug 2011 12:25:16 PM UTC, original submission:  

str2num does not return an empty matrix properly when receiving non-numeric input.

octave:5> str2num('1+2*a')                           
stopped in /usr/local/share/octave/3.5.0+/m/strings/str2num.m
debug> dbstack
stopped in:

  --> str2num at line 58 [/usr/local/share/octave/3.5.0+/m/strings/str2num.m]
debug>

octave:5>




I have set debug_on_error(1), but I don't think that is the problem because the eval example works fine:




octave:4>    eval ('error ("This is a bad example");',

>                'printf ("This error occurred:\n%s\n", lasterr ());');

This error occurred:
This is a bad example
octave:5>

Ben Barrowes <barrowes>

 

(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 bpabbott (Posted a comment)
  • -email is unavailable- added by barrowes (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
    2011-09-18 bpabbott Open/ClosedOpen Closed
    2011-09-01 bpabbott StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code