Open eullerborges opened 3 years ago
This comment on the release notes for v2.6 mention this issue should apparently have been fixed:
An error is now thrown when
__init__
is forgotten on subclasses. This was incorrect before, but was not checked. Add a call to__init__
if it is missing.
But I am running this on v2.6.2 and can still reproduce it.
Issue description
When exposing a C++ abstract interface that should be implemented in Python-land, if the derived python class doesn't call
super().__init__()
, calling functions on the interface from the C++-land will result in an UBSan violation and a subsequent segmentation fault.This is quite unintuitive since the base class is abstract and one would not expect it to be necessary to call the base constructor.
Reproducible example code
Define bindings:
(note that
keep_alive
is used to guarantee this is not related to the temporary object going out of scope: the issue also happens when keeping the reference around)Try to use on the python side:
Note that the python implementation doesn't even define
do_action
: we never really get toMyIfcPy::callback
for the error to be thrown. This results in the following UBSan violation:and the subsequent segmentation fault: