bugGNU Octave - Bugs: bug #52096, meta.class.fromName throws error...

 
 

bug #52096: meta.class.fromName throws error when class name not found.

Submitted by:  Piotr Held <jsoh425>
Submitted on:  Sat 23 Sep 2017 12:26:23 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: NoneAssigned to: None
Originator Name: Piotr HeldOpen/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 26 Sep 2017 07:45:53 PM UTC, comment #5:

Piotr, I looked at this for a while but don't see a straightforward way to create an empty meta.class or meta.package object. There really should be a simple way to construct one of those things, and if there isn't one now, we should fix that. But I don't really understand the classdef code.

John W. Eaton <jwe>
Project Administrator
Tue 26 Sep 2017 05:15:40 PM UTC, comment #4:

Oops, should be fixed with this change: http://hg.savannah.gnu.org/hgweb/octave/rev/e3fade9160f3

John W. Eaton <jwe>
Project Administrator
Tue 26 Sep 2017 05:01:08 PM UTC, comment #3:

I'm seeing two regressions in the test suite that may be due to this issue.

and

Does someone who understands this want to comment?

Rik <rik5>
Project Administrator
Mon 25 Sep 2017 08:34:47 PM UTC, comment #2:

There is a way to return an empty package or class array (at least from the interpreter). I have not yet figured out how to do it from code. From the interpreter the proper code would be:

I don't know if that's of any help though...

Piotr Held <jsoh425>
Mon 25 Sep 2017 08:07:12 PM UTC, comment #1:

If Matlab does not throw an error for this case, then an empty matrix seems like a better result than an error. But is there any way for us to also return an empty class or package array? If we can't create empty package or class arrays, then I suppose there should be a bug report about that if one does not already exist...

In any case, I checked in the change after editing the commit message:

http://hg.savannah.gnu.org/hgweb/octave/rev/4d9ceaf17dda

John W. Eaton <jwe>
Project Administrator
Sat 23 Sep 2017 12:26:23 AM UTC, original submission:

The same happens for meta.package.fromName.
For Matlab these functions simply return an empty (0x0) class array or package array. I wrote a simple patch that returns just an empty object ([](0x0)) instead. The functionality is already built-into Octave in the functions:
cdef_manager::find_class
cdef_manager::find_package.
The only change I made was to call them with the proper argument: error_if_not_found == false.

I am attaching a patch in to this submission.

Piotr Held <jsoh425>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #41872:  meta_no_error_patch.diff added by jsoh425 (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jsoh425 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 23 Sep 2017 12:26:23 AM UTCjsoh425Attached File-=>Added meta_no_error_patch.diff, #41872

    Back to the top


    Powered by Savane 3.1-cleanup1