bugGNU Octave - Bugs: bug #58565, isprop() doesn't work for classdef...

 
 

bug #58565: isprop() doesn't work for classdef instances

Submitter:  Neil Konzen <waterdog1>
Submitted:  Sun 14 Jun 2020 11:36:06 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  waterdog1 Open/Closed:  * Closed
Release:  * 5.2.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 14 Jun 2020 06:37:21 PM UTC, comment #1: 

Thanks for your report.

Luckily this has already been fixed in bug #50812 on the default branch (which will eventually become Octave 7):
https://hg.savannah.gnu.org/hgweb/octave/rev/925fe981a25c

In the meantime, since this is an m-file, you could replace your local file with the one from the repository:
https://hg.savannah.gnu.org/hgweb/octave/file/47d4a84a5725/scripts/plot/util/isprop.m


Markus Mützel <mmuetzel>
Group administrator
Sun 14 Jun 2020 11:36:06 AM UTC, original submission:  

isprop() always fails for classdef instances.

With the following class in the current directory:


classdef value_class
properties
foo = 123.45;
end
end


The following code illustrates the problem:


obj=value_class();
assert(isprop(obj,'foo'));


An easy fix is to use .() inside a try/catch.  In isprop.m, replace the innermost endif with:


elseif isobj(obj)
  try
    v = obj.(prop);
    res(i) = true;
  end_try_catch
endif


Neil Konzen <waterdog1>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by waterdog1 (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
    2020-06-14 mmuetzel StatusNone Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #50812

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code