bugGNU Octave - Bugs: bug #65280, help for classdef method not shown...

 
 

bug #65280: help for classdef method not shown until object instantiated

Submitter:  Colin Macdonald <cbm>
Submitted:  Fri 09 Feb 2024 08:19:19 AM UTC
   
 
Category:  Classdef Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Need Info Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 11 Feb 2024 07:14:25 AM UTC, comment #9: 

Re: test in comment #3:



>> help pyobject.char
error: help: 'pyobject.char' is not documented

>> help @pyobject/char
'@pyobject/char' is a class method

 -- Method on @pyobject: char (X)
     Conversion method to string.

     Example:
          s = pyobject ("hello world");
          char (s)
                ⇒ hello world

     See also: pyobject.disp.


Confusingly (to me) accessing `help @pyobject/char` means that instantiating the class no longer fixes `help pyoject.char`.  Compare following to Comment #2:


>> help @pyobject/char
'@pyobject/char' is a function from the file /home/cbm/src/octave-pythonic.git/inst/@pyobject/char.m

 -- Method on @pyobject: char (X)
     Conversion method to string.

     Example:
          s = pyobject ("hello world");
          char (s)
                ⇒ hello world

     See also: pyobject.disp.

>> x  = pyobject (6)
x = [Python object of type float]
  6.0

>> help pyobject.char
error: help: 'pyobject.char' is not documented
-veratim-

Colin Macdonald <cbm>
Fri 09 Feb 2024 06:56:03 PM UTC, comment #8: 

I bet this is still a symptom of bug #61521.  Test case in comment #3 would confirm it.

When 'help ftp.ascii' works, then 'help pyobject.char' will too.

Rik <rik5>
Group administrator
Fri 09 Feb 2024 06:41:27 PM UTC, comment #7: 


> Having methods of classdef classes in separate files inside an @folder is not "old-style". That is how classdef classes are supposed to work.


Okay.  I don't use this feature of Matlab so I don't know what the reference behavior is supposed to be.

Rik <rik5>
Group administrator
Fri 09 Feb 2024 05:54:41 PM UTC, comment #6: 

Having methods of classdef classes in separate files inside an @folder is not "old-style". That is how classdef classes are supposed to work. (And it's a good way to have half-decent browsable sources for large classdef classes.)

Markus Mützel <mmuetzel>
Group administrator
Fri 09 Feb 2024 05:44:37 PM UTC, comment #5: 

pyobject appears to be a mixed old-style/new-style class.  It has a classdef object, but also has old-style class methods in their own function files under the @pyobject directory.

See https://gitlab.com/gnu-octave/octave-pythonic/-/blob/main/inst/@pyobject/char.m?ref_type=heads.

Rik <rik5>
Group administrator
Fri 09 Feb 2024 05:31:52 PM UTC, comment #4: 
Markus Mützel <mmuetzel>
Group administrator
Fri 09 Feb 2024 04:54:47 PM UTC, comment #3: 

Is this just a different manifestation of bug #61521?

Old-style classes don't have support for the dot notation, but do have support for extended style slash notation.

Does this work?


help @pyobject/char


Rik <rik5>
Group administrator
Fri 09 Feb 2024 03:49:52 PM UTC, comment #2: 

Oops sorry, yeah same behaviour on today's default:


octave:4> help pyobject.char
error: help: 'pyobject.char' is not documented

octave:5> x = pyobject (6)
x = [Python object of type float]
  6.0

octave:6> help pyobject.char
'pyobject.char' is a function from the file /home/cbm/src/octave-pythonic.git/inst/@pyobject/char.m

 -- Method on @pyobject: char (X)
     Conversion method to string.

     Example:
          s = pyobject ("hello world");
          char (s)
                ⇒ hello world

     See also: pyobject.disp.


I forgot to say, but its not sufficient to `help pyobject`:

octave:1> help pyobject.char
error: help: 'pyobject.char' is not documented

octave:2> help pyobject
'pyobject' is a class constructor from the file /home/cbm/src/octave-pythonic.git/inst/@pyobject/pyobject.m

 -- Function: pyobject (S)
     Wrap a Python object.

     This is the help for the pyobject class.

     See also: pyexec, pyeval.

octave:3> help pyobject.char
error: help: 'pyobject.char' is not documented


Colin Macdonald <cbm>
Fri 09 Feb 2024 08:41:34 AM UTC, comment #1: 

Looking at the warnings, you seem to be using a build from the bytecode-interpreter branch.
Do you also see this issue for a build from the default branch?

Markus Mützel <mmuetzel>
Group administrator
Fri 09 Feb 2024 08:19:19 AM UTC, original submission:  


>> pkg load pythonic

>> help pyobject.char
error: help: 'pyobject.char' is not documented
error: called from
    help at line 114 column 9

>> x = pyobject (6)
warning: auto-compilation of pyobject failed with message classdef constructors are not supported by the VM yet
x = [Python object of type float]
  6.0

>> help pyobject.char
'pyobject.char' is a function from the file /home/cbm/.local/share/octpkgs/10.0.0/pythonic-0.1.3/@pyobject/char.m

 -- Method on @pyobject: char (X)
     Conversion method to string.

     Example:
          s = pyobject ("hello world");
          char (s)
                ⇒ hello world

     See also: @@pyobject/disp.


### file-structure of this classdef class:


@pyobject/
@pyobject/pyobject.m
@pyobject/char.m

See https://gitlab.com/gnu-octave/octave-pythonic/-/tree/main/inst/@pyobject?ref_type=heads


### reproducing:

I'm at a recent commit of Octave:


commit 217dbb6cae696c0631312407e4ac333eb765d48a (origin/default)
Merge: ae86e72e61 c76dd2e856
Author: Rik <rik@octave.org>
Date:   Thu Feb 8 11:35:20 2024 -0800

    maint: merge stable to default


Install the pythonic package (`pkg install -forge pythonic`), version 3.1.1 at time of writing.  Can also be reproduced from in the source tree.

### Related issues

https://savannah.gnu.org/bugs/index.php?62804
https://savannah.gnu.org/bugs/index.php?48041

Colin Macdonald <cbm>

 

(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 mmuetzel (Posted a comment)
  • -email is unavailable- added by cbm (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.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-09 mmuetzel StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code