Skip to content

C++ exceptions thrown in SIDE_MODULES not caught (by other modules?) #9691

Closed
@johnwason

Description

@johnwason

I am using the Pyodide project with Emscripten to compile a C++ Python library for use in the browser. I have found that exceptions are working sometimes, but other times they are not caught correctly and filter back to Python instead. If the throw and catch are in the same function, it seems to work correctly. If they are in different functions, it is not caught. Because of the use of Boost and CMake the module has to be built separately, so it is possible. I haven't found the magic combination of compiler flags to make it work. Pyodide is using side modules with dynamic loading. I looked through the generated wasm text code and the exception checks were being generated.

The original issue with more details can be found here:

pyodide/pyodide#545

Test case:

https://gist.github.com/johnwason/422b0bd9787088db3d12b422a6a835ff

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