Menu

#879 Don't generate new/del for abstract director class

open
python (260)
5
2023-06-13
2007-12-08
didou_83
No

I seems there are a bug or an incoherence in director functionnality.

I use C++/Python

------------------------------------

When whe declare in an interface file
with a pure virtual function C::F1

%feature("director") C;
%feature("nodirector") C::F2;

the functions new_C, delete_C and the proxy python constructor C.__init__(self,id) is generated (logic, it's necessary to expand this class in Python code and code function F1)

---------------------------------

But if I use the interface file with the same F1 pure virtual function

%feature("director") C::F1;

the functions new_C, delete_C and proxy constructor C.__init__ is not generated. So it's impossible to expand this class in python.

---------------------------------

the generation of these functions and proxy constructor seems to be inhibited for abstract Class, except if the class is declared "director" (logic).

But I think that another exception should be "one of method of this class is declared director"

-----------------------------------

Attached tar file :
C1.i => interface 1
C2.i => interface 2
C.hpp => C++ file used by interface

Discussion

  • didou_83

    didou_83 - 2007-12-08

    Sample of description

     
  • didou_83

    didou_83 - 2007-12-08
    • summary: Don't generate new/del for class with method "director" --> Don't generate new/del for abstract director class
     
  • didou_83

    didou_83 - 2007-12-08

    Logged In: YES
    user_id=1323907
    Originator: YES

    In fact, these function shouldn't be generated if it exists a virtual pure function wich is not declare as "director"

     
  • Olly Betts

    Olly Betts - 2022-01-28

    Still seems to reproduce with current git master.

    We have testcases that exercise this sort of thing, but I guess either not exactly the same, or the testcases don't fail because of this issue - e.g. Examples/test-suite/allprotected_not.i starts:

    / Tests directors and allprotected option when the class does not have the "director" feature                                                                                                
    // Was previously crashing and/or generating uncompilable code.                                                                                                                               
    
    %module(directors="1", allprotected="1") allprotected_not                                                                                                                                     
    
    //%feature("director") AllProtectedNot;                                                                                                                                                       
    %feature("director") AllProtectedNot::ProtectedMethod;                                                                                                                                        
    

    [...]

     
  • Olly Betts

    Olly Betts - 2023-06-13

    Still reproducible. Looks like https://sourceforge.net/p/swig/bugs/1250/ is closely related and probably the same issue.

     

Log in to post a comment.