Skip to content

pycapnp v2.0.0 incompatible with Cython 3.0+ #377

Open
@Dillon-McCardell

Description

@Dillon-McCardell

When building pycapnp 2.0.0 with Cython 3.0, multiple compilation errors occur due to stricter C++ exception handling requirements in the newer Cython version. The errors indicate that only extern functions can throw C++ exceptions.

Example error:

Error compiling Cython file:
capnp/lib/capnp.pyx:1032:10: Only extern functions can throw C++ exceptions.

This occurs in multiple functions throughout capnp/lib/capnp.pyx that use the except +reraise_kj_exception syntax but aren't marked as extern. Some affected functions include:

  • _get(self, field)
  • to_bytes(_DynamicStructBuilder self)
  • to_segments(_DynamicStructBuilder self)
  • _to_bytes_packed_helper(_DynamicStructBuilder self, word_count)

To maintain compatibility with Cython 3.0+, these functions need to be marked as extern or the exception handling approach needs to be modified. Currently, the only workaround is to pin to an older version of Cython (pre-3.0), which isn't ideal for long-term maintenance.

Environment:

  • pycapnp version: 2.0.0
  • Cython version: 3.0.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions