bugGNU Octave - Bugs: bug #44940, Empty class indexing should result...

 
 

bug #44940: Empty class indexing should result in copy of object rather than error

Submitted by:  Rik <rik5>
Submitted on:  Mon 27 Apr 2015 03:43:27 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
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.

 

Thu 14 May 2015 03:02:52 PM UTC, comment #4:

I added comments to the diffs and checked in jwe's changes here (http://hg.savannah.gnu.org/hgweb/octave/rev/b2532deba721). I added comments and a missing module.mk file and checked in Carnë's changes here (http://hg.savannah.gnu.org/hgweb/octave/rev/38487298513b).

Closing report.

Rik <rik5>
Project Administrator
Wed 06 May 2015 05:35:15 PM UTC, comment #3:

Since this is a handle class, you could modify a property in one of the objects and see if it also changes in the other (as it should).

John W. Eaton <jwe>
Project Administrator
Wed 06 May 2015 05:17:15 PM UTC, comment #2:

The proposed fix works for me too, and doesn't cause any of the tests to fail. Unfortunately we don't have that much stuff in core with tests that uses classdef to pick up any problem.

I wrote a simple test for this (attached). It modifies properties on the copy to check that indeed we get the same object.

Doing this, I noticed that there's no way to check that two variables actually hold the same object (I couldn't find anything on Matlab documentation either). isequal will compare the values of the object properties so it's not good for this.

(file #33944)

Carnë Draug <carandraug>
Project Member
Wed 06 May 2015 03:05:48 PM UTC, comment #1:

I'm attaching a possible fix for this problem. It seems to work for me.

(file #33942)

John W. Eaton <jwe>
Project Administrator
Mon 27 Apr 2015 03:43:27 PM UTC, original submission:

This is a continuation of the bug and fix in this patch report (https://savannah.gnu.org/patch/?8152#postcomment). Previously, Octave was segfaulting when an attempty was made to use a null index on a class object. For example

The classdef file foo.m is attached to this report. In this cset Octave was changed to issue an error and stop segfaulting (http://hg.savannah.gnu.org/hgweb/octave/rev/274b52724931). This is certainly preferable.

However, for ultimate Matlab compatibility Octave should simply return the base object x rather than issue an error. Testing of that was done in the patch cited.

Probable solution is something like retval = this, but using the correct syntax.

Rik <rik5>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #33944:  bug44940.cset added by carandraug (1KiB - application/octet-stream)
file #33942:  classdef-diffs added by jwe (2KiB - application/octet-stream)
file #33817:  foo.m added by rik5 (66B - text/x-objcsrc)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by rik5 (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):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 22 Dec 2017 12:33:37 PM UTCmmuetzelDependencies-=>bugs #52724 is dependent
    Thu 14 May 2015 03:03:10 PM UTCrik5Open/ClosedOpen=>Closed
    Thu 14 May 2015 03:02:52 PM UTCrik5StatusPatch Submitted=>Fixed
    Wed 06 May 2015 05:17:15 PM UTCcarandraugAttached File-=>Added bug44940.cset, #33944
    Wed 06 May 2015 03:05:48 PM UTCjweAttached File-=>Added classdef-diffs, #33942
      StatusConfirmed=>Patch Submitted
    Mon 27 Apr 2015 03:43:27 PM UTCrik5Attached File-=>Added foo.m, #33817

    Back to the top


    Powered by Savane 3.1-cleanup1