Skip to content

[BUG] migration to cython3.0.5: redefinition of '__Pyx_Enum_<enum_name>_to_py #5860

@EdwardSro

Description

@EdwardSro

Describe the bug

I'm having an issue with migrating PyVerbs package, part of the upstream rdma-core, to cython3.
We've been working for a few years with Cython 0.2X.YY versions without the below issues.
And I didn't find a solved issue for this or any relevant notes in the migration document.

<path-to-rdma-core>/rdma-core/build-fc39/pyverbs/srq.c:5528:18: error: redefinition of '__Pyx_Enum_ibv_ops_wr_opcode_to_py'
5528 | static PyObject *__Pyx_Enum_ibv_ops_wr_opcode_to_py(enum ibv_ops_wr_opcode __pyx_v_c_val) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<path-to-rdma-core>/rdma-core/build-fc39/pyverbs/srq.c:4511:18: note: previous definition of '__Pyx_Enum_ibv_ops_wr_opcode_to_py' with type 'PyObject *(enum ibv_ops_wr_opcode)' {aka 'struct _object *(enum ibv_ops_wr_opcode)'}
4511 | static PyObject *__Pyx_Enum_ibv_ops_wr_opcode_to_py(enum ibv_ops_wr_opcode __pyx_v_c_val) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[420/575] Building C object pyverbs/CMakeFiles/cq.cpython-312-x86_64-linux-gnu.dir/cq.c.o

Code to reproduce the behaviour:

Go to rdma-core project and checkout this PR branch:Update to fc39
Then, to build, and reproduce, you can do:

buildlib/cbuild build-images fc39
buildlib/cbuild make fc39

Expected behaviour

I expect the compilation to pass as it's been passing on any Cython 0.29.XY versions.
The cythonization process creates a duplicate enum definition in the C files due to the "inlucde <pxd_file_name>.pxd" lines.

OS

Linux

Python version

3.10.8

Cython version

3.0.5 (actually from any cython3 version)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions