diff --git a/wrap/Class.cpp b/wrap/Class.cpp index 7aa4cd72a..9336dc9dc 100644 --- a/wrap/Class.cpp +++ b/wrap/Class.cpp @@ -827,13 +827,13 @@ void Class::emit_cython_pyx(FileWriter& pyxFile, const std::vector& allCl " self." << shared_pxd_obj_in_pyx() << " = " << shared_pxd_class_in_pyx() << "()\n"; + pyxFile.oss << " if len(args)==0 and len(kwargs)==1 and kwargs.has_key('cyCreateFromShared'):\n return\n"; for (size_t i = 0; i0) { - pyxFile.oss << " elif len(args)+len(kwargs)==0:\n return\n"; pyxFile.oss << " else:\n raise TypeError('" << pyxClassName() << " construction failed!')\n"; } @@ -849,7 +849,7 @@ void Class::emit_cython_pyx(FileWriter& pyxFile, const std::vector& allCl pyxFile.oss << " @staticmethod\n"; pyxFile.oss << " cdef " << pyxClassName() << " cyCreateFromShared(const " << shared_pxd_class_in_pyx() << "& other):\n" - << " cdef " << pyxClassName() << " ret = " << pyxClassName() << "()\n" + << " cdef " << pyxClassName() << " ret = " << pyxClassName() << "(cyCreateFromShared=True)\n" << " ret." << shared_pxd_obj_in_pyx() << " = other\n"; pyxInitParentObj(pyxFile, " ret", "other", allClasses); pyxFile.oss << " return ret" << "\n";