[cython] bypass a problem with no default constructor
Add this to support cyCreateFromShared, which needs to call the default Python constructor to construct the Python object before reassigning the internal shared ptr to the c++ object.release/4.3a0
parent
ed8f7c5f82
commit
5a8bd5afda
|
@ -832,9 +832,11 @@ void Class::emit_cython_pyx(FileWriter& pyxFile, const std::vector<Class>& allCl
|
|||
<< pyxClassName() << "_" << i
|
||||
<< "(*args, **kwargs):\n pass\n";
|
||||
}
|
||||
if (constructor.nrOverloads()>0)
|
||||
if (constructor.nrOverloads()>0) {
|
||||
pyxFile.oss << " elif len(args)+len(kwargs)==0:\n return\n";
|
||||
pyxFile.oss << " else:\n raise TypeError('" << pyxClassName()
|
||||
<< " construction failed!')\n";
|
||||
}
|
||||
|
||||
pyxInitParentObj(pyxFile, " self", "self." + shared_pxd_obj_in_pyx(), allClasses);
|
||||
pyxFile.oss << "\n";
|
||||
|
|
Loading…
Reference in New Issue