Skip to content

Multiple static functions, with same name and different parameters in a class will only expose one #1851

Closed
@unier

Description

@unier

Example:

c++:

class SqBufferIoStream : public SqIoStream {
public:
	static std::shared_ptr<SqBufferIoStream> Open(const std::string& data);
	static std::shared_ptr<SqBufferIoStream> Open();
};

cython:

cdef extern from "SqBufferIoStream.h":
    cdef cppclass SqBufferIoStream:
        @staticmethod
        shared_ptr[SqBufferIoStream] Open(const string s)
        @staticmethod
        shared_ptr[SqBufferIoStream] Open()
Error compiling Cython file:
------------------------------------------------------------
        for command, description in c_map:
            p_map[command] = description
        return p_map

    def executeCommand(self, command, parameters):
        cdef shared_ptr[SqInputStream] b = dynamic_pointer_cast[SqInputStream, SqBufferIoStream](SqBufferIoStream.Open(_json.dumps(parameters)))
                                                                                                                     ^
------------------------------------------------------------

SqFoundationTypes.pyx:200:118: Call with wrong number of arguments (expected 0, got 1)

If I change to:

cdef extern from "SqBufferIoStream.h":
    cdef cppclass SqBufferIoStream:
        @staticmethod
        shared_ptr[SqBufferIoStream] Open()
        @staticmethod
        shared_ptr[SqBufferIoStream] Open(const string s)
Error compiling Cython file:
------------------------------------------------------------

    def executeCommand(self, command, parameters):
        cdef shared_ptr[SqInputStream] b = dynamic_pointer_cast[SqInputStream, SqBufferIoStream](SqBufferIoStream.Open(_json.dumps(parameters)))
        cdef SqKeyValueList data = SqJsonParser.ParseAsSqValue(b).get().GetKeyValueList()
        cdef SqKeyValueList c_kvl = self.c_this.get().ExecuteCommand(command, data)
        cdef shared_ptr[SqBufferIoStream] buf = SqBufferIoStream.Open()
                                                                    ^
------------------------------------------------------------

SqFoundationTypes.pyx:203:69: Call with wrong number of arguments (expected 1, got 0)

Version:

cython --version
Cython version 0.25.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions