Skip to content

Conversion function redefinition error when handling C++ types #3741

@KmolYuan

Description

@KmolYuan

I have a extension class which including C++ member (std::vector<my_struct>, and my_struct has some std::pair<int, int> members).
And there also has a std::pair<int, int> type definition in the same source.

I'm found that the conversion function (std::pair<int, int> to tuple[int, int]) is defined twice unless added @cython.auto_pickle(False) on my extension class.

11510:18: error: redefinition of 'PyObject* __pyx_convert_pair_to_py_int____int(const std::pair<int, int>&)'
 static PyObject *__pyx_convert_pair_to_py_int____int(std::pair<int,int>  const &__pyx_v_p) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10055:18: note: 'PyObject* __pyx_convert_pair_to_py_int____int(const std::pair<int, int>&)' previously defined here
 static PyObject *__pyx_convert_pair_to_py_int____int(std::pair<int,int>  const &__pyx_v_p) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm not clearly know how Cython checks the tool functions of ctypedef.
In another case My extension members are sharing a same ctypedef with local variables, but this error is not occurred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions