diff --git a/wrap/Constructor.cpp b/wrap/Constructor.cpp index 515204751..b7a219458 100644 --- a/wrap/Constructor.cpp +++ b/wrap/Constructor.cpp @@ -145,7 +145,7 @@ void Constructor::emit_cython_pxd(FileWriter& pxdFile, Str className) const { void Constructor::emit_cython_pyx(FileWriter& pyxFile, const Class& cls) const { for (size_t i = 0; i < nrOverloads(); i++) { ArgumentList args = argumentList(i); - pyxFile.oss << "\tdef " + name_ + "_" + to_string(i) + + pyxFile.oss << "\tdef " + cls.pyxClassName() + "_" + to_string(i) + "(self, *args, **kwargs):\n"; pyxFile.oss << pyx_resolveOverloadParams(args, true); diff --git a/wrap/GlobalFunction.cpp b/wrap/GlobalFunction.cpp index 6d083d80b..d148627ec 100644 --- a/wrap/GlobalFunction.cpp +++ b/wrap/GlobalFunction.cpp @@ -156,7 +156,7 @@ void GlobalFunction::emit_cython_pyx_no_overload(FileWriter& file) const { file.oss << "def " << funcName; // modify name of function instantiation as python doesn't allow overloads // e.g. template funcName(...) --> funcNameA, funcNameB, funcNameC - if (templateArgValue_) file.oss << templateArgValue_->name(); + if (templateArgValue_) file.oss << templateArgValue_->pyxClassName(); // funtion arguments file.oss << "("; argumentList(0).emit_cython_pyx(file); diff --git a/wrap/Method.cpp b/wrap/Method.cpp index 5b72ffd32..f6d0bf41c 100644 --- a/wrap/Method.cpp +++ b/wrap/Method.cpp @@ -106,7 +106,7 @@ void Method::emit_cython_pyx_no_overload(FileWriter& file, file.oss << "\tdef " << funcName; // modify name of function instantiation as python doesn't allow overloads // e.g. template funcName(...) --> funcNameA, funcNameB, funcNameC - if (templateArgValue_) file.oss << templateArgValue_->name(); + if (templateArgValue_) file.oss << templateArgValue_->pyxClassName(); // funtion arguments file.oss << "(self"; if (argumentList(0).size() > 0) file.oss << ", "; @@ -132,7 +132,7 @@ void Method::emit_cython_pyx(FileWriter& file, const Class& cls) const { // doesn't allow overloads // e.g. template funcName(...) --> funcNameA, funcNameB, funcNameC string instantiatedName = - (templateArgValue_) ? funcName + templateArgValue_->name() : funcName; + (templateArgValue_) ? funcName + templateArgValue_->pyxClassName() : funcName; size_t N = nrOverloads(); // It's easy if there's no overload diff --git a/wrap/Qualified.h b/wrap/Qualified.h index 0e92a3c6c..00dc56e44 100644 --- a/wrap/Qualified.h +++ b/wrap/Qualified.h @@ -201,7 +201,10 @@ public: /// To refer to a Cython class in pyx, we need to add "pxd.", e.g. pxd.noiseModel_Gaussian /// see the other function pxd_class_in_pyx for that purpose. std::string pyxClassName() const { - return pxdClassName(); + if (isEigen()) + return name_; + else + return qualifiedName("_", 1); } /// Python type of function arguments in pyx to interface with normal python scripts