Skip to content
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
275f76f
Use webassembly exception handling
hoodmane Jan 13, 2025
9fc5a41
Update pyodide-build
hoodmane Jan 13, 2025
b47340e
Update toolchain version in pyodide
hoodmane Jan 13, 2025
139bf61
Remove build script from rust-panic-test
hoodmane Jan 13, 2025
26f23f0
Only download rust toolchain once
hoodmane Jan 13, 2025
f7d46db
Update pyodide-build commit again
hoodmane Jan 13, 2025
bd1ab86
Adjust flags
hoodmane Jan 13, 2025
fe5fc14
Clean up error handling code
hoodmane Jan 14, 2025
92f672c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2025
d0c83db
Remove createInvoke tests
hoodmane Jan 14, 2025
1e739d0
Remove error handling Emscirpten patch
hoodmane Jan 14, 2025
271a2ce
Fix cpp-exceptions-test
hoodmane Jan 14, 2025
c962a45
Disable primecountpy
hoodmane Jan 14, 2025
0a4d37f
Reenable primecountpy
hoodmane Jan 14, 2025
3e84c57
Update pyodide-build
hoodmane Jan 14, 2025
111f9b3
Disable wasm-sjlj in opencv-python
hoodmane Jan 14, 2025
ad17170
Disable clarabel
hoodmane Jan 14, 2025
40f8127
Move -fwasm-exceptions to LDFLAGS_BASE
hoodmane Jan 14, 2025
38bf674
Update compiler version
hoodmane Jan 14, 2025
0126910
Disable pacakges in no-numpy-dependents with test failures
hoodmane Jan 14, 2025
1ad3c34
Try to fix opencv-python
hoodmane Jan 14, 2025
eb37cca
Update pyodide-build commit again
hoodmane Jan 15, 2025
eb1978b
Don't change opencv-python recipe
hoodmane Jan 15, 2025
893ebd3
Set RUST_EMSCRIPTEN_TARGET_URL
hoodmane Jan 15, 2025
ea109ff
Merge branch 'main' into wasm-eh
hoodmane Jan 15, 2025
fb80f2d
Update rustflags and cryptography recipe
hoodmane Jan 15, 2025
7e6c080
Drop wasm_bigint and link-native-libs
hoodmane Jan 15, 2025
1ce7612
Merge branch 'main' into wasm-eh
hoodmane Jan 15, 2025
3f0c1fe
fix disables
hoodmane Jan 16, 2025
60462e3
Add TODOs for external built platformed packages
hoodmane Jan 16, 2025
c088ed4
Update docker image to use beta rustup
hoodmane Jan 16, 2025
5310d23
Update comment
hoodmane Jan 16, 2025
b5bda14
Merge branch 'beta-rustup' into wasm-eh
hoodmane Jan 16, 2025
6122c9a
Merge branch 'main' into wasm-eh
hoodmane Jan 16, 2025
53ccfe1
Merge branch 'main' into wasm-eh
hoodmane Jan 21, 2025
4324454
Fix spelling
hoodmane Jan 21, 2025
beafa37
Fix merge
hoodmane Jan 21, 2025
9422d71
minor rearrange in makefile.envs
hoodmane Jan 21, 2025
88913e4
Merge branch 'main' into wasm-eh
hoodmane Jan 21, 2025
34c2d9a
Disable python-flint
hoodmane Jan 25, 2025
96823c4
Merge branch 'main' into wasm-eh
hoodmane Jan 27, 2025
007df5d
Reenable some packages
hoodmane Jan 28, 2025
b34788b
Update pyodide-build
hoodmane Jan 30, 2025
c66c85d
Fix glpk
hoodmane Jan 30, 2025
ac04c84
Merge branch 'main' into wasm-eh
hoodmane Jan 30, 2025
6388b48
Merge branch 'main' into wasm-eh
hoodmane Jan 31, 2025
b9df3f9
Fix pygame-ce
hoodmane Jan 31, 2025
e2b7fd1
Add reference to upstream PR in patch notes
hoodmane Jan 31, 2025
a73dd8c
Fix nodylink build
hoodmane Jan 31, 2025
b7e1198
Fix gdal
hoodmane Jan 31, 2025
35ca6ae
Revert changes to primecount
hoodmane Jan 31, 2025
de65d7b
Fix opencv-python sjlj
hoodmane Jan 31, 2025
65f4b00
Disable ppl
hoodmane Jan 31, 2025
f2efc9b
Fix ppl
hoodmane Jan 31, 2025
42d39ea
Fix python-flint
hoodmane Jan 31, 2025
e045d82
Disable gdal
hoodmane Jan 31, 2025
daec9a4
Reenable gdal
hoodmane Jan 31, 2025
e5b9409
Merge branch 'main' into wasm-eh
hoodmane Jan 31, 2025
d8c54f7
Merge branch 'main' into wasm-eh
hoodmane Feb 1, 2025
774fae4
Merge branch 'main' into wasm-eh
hoodmane Feb 3, 2025
dec7512
Merge branch 'main' into wasm-eh
hoodmane Feb 3, 2025
03c1719
Verbose gdal make
hoodmane Feb 3, 2025
af6a8b3
Fix gdal recipe
hoodmane Feb 3, 2025
e310e5f
xfail test_cpp_exceptions_and_syncify
hoodmane Feb 3, 2025
eb2347d
Add stackSave and stackRestore to exported runtime methods
hoodmane Feb 4, 2025
f1090bb
Update changelog
hoodmane Feb 4, 2025
f1a0dec
Revert arro3-io change
hoodmane Feb 4, 2025
eb0db1d
Update docs/project/changelog.md
hoodmane Feb 23, 2025
88f7111
Merge branch 'main' into wasm-eh
hoodmane Feb 23, 2025
2efe35d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 23, 2025
cdcb549
Download emscripten target from pyodide/rust-emscripten-wasm-eh-sysroot
hoodmane Feb 26, 2025
84d2bfe
Revert accidental change
hoodmane Feb 26, 2025
12dd43e
Add comment about sjlj to changelog
hoodmane Feb 26, 2025
7f659f4
Merge branch 'main' into wasm-eh
hoodmane Feb 26, 2025
19fd6de
Update pyodide-build
hoodmane Feb 27, 2025
42e54f5
Use pyodide-build main branch
hoodmane Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Makefile.envs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ export PYODIDE_ABI_VERSION ?= 2025_0

export PYTHON_ARCHIVE_SHA256=73ac8fe780227bf371add8373c3079f42a0dc62deff8d612cd15a618082ab623

export RUST_TOOLCHAIN ?= nightly-2025-01-15
export RUST_EMSCRIPTEN_TARGET_URL ?= http://pyodide-cache.s3-website-us-east-1.amazonaws.com/rustc-emscripten-target/${RUST_TOOLCHAIN}.tar.bz2
Comment thread
hoodmane marked this conversation as resolved.
Outdated
# I'm not really sure what this explicit -Z link-native-libraries=yes is for,
# `rustc -Z help` shows that `link-native-libraries=yes` is the default. But it
# seems to be necessary...
export RUSTFLAGS = -C link-arg=-sSIDE_MODULE=2 -Z link-native-libraries=yes
export RUSTFLAGS = -C link-arg=-sSIDE_MODULE=2 -Z link-native-libraries=yes -Z emscripten-wasm-eh

# URL to the prebuilt packages
export PYODIDE_PREBUILT_PACKAGES_BASE=https://github.com/pyodide/pyodide-recipes/releases/download/20250114
Expand Down Expand Up @@ -129,6 +131,8 @@ export CFLAGS_BASE=\
$(OPTFLAGS) \
$(DBGFLAGS) \
-fPIC \
-fwasm-exceptions \
-sSUPPORT_LONGJMP \
$(EXTRA_CFLAGS)


Expand All @@ -138,7 +142,9 @@ export LDFLAGS_BASE=\
$(DBG_LDFLAGS) \
-L$(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/ \
-s WASM_BIGINT \
$(EXTRA_LDFLAGS)
-fwasm-exceptions \
-sSUPPORT_LONGJMP \
$(EXTRA_LDFLAGS) \

export CXXFLAGS_BASE=

Expand All @@ -148,7 +154,6 @@ export MAIN_MODULE_LDFLAGS= $(LDFLAGS_BASE) \
-s LZ4=1 \
-s EXPORT_NAME="'_createPyodideModule'" \
-s EXPORT_EXCEPTION_HANDLING_HELPERS \
-s EXCEPTION_CATCHING_ALLOWED=['we only want to allow exception handling in side modules'] \
-sEXPORTED_RUNTIME_METHODS='wasmTable,ERRNO_CODES' \
-s USE_ZLIB \
-s USE_BZIP2 \
Expand Down Expand Up @@ -234,14 +239,15 @@ EXPORTS=_main \
,__PyTraceback_Add \
,_PyUnicode_Data \
,_PyUnicode_New \
,_emscripten_stack_get_current \
,_Py_Version \


ifeq ($(DISABLE_DYLINK), 1)
export MAIN_MODULE_LDFLAGS= $(LDFLAGS_BASE) \
-s MODULARIZE=1 \
-s EXPORT_NAME="'_createPyodideModule'" \
-sEXPORTED_RUNTIME_METHODS='wasmTable,ERRNO_CODES,FS,ENV,stringToNewUTF8,addFunction' \
-sEXPORTED_RUNTIME_METHODS='wasmTable,ERRNO_CODES,FS,ENV,stringToNewUTF8,addFunction,stackSave,stackRestore' \
-s LZ4=1 \
-s USE_ZLIB \
-s USE_BZIP2 \
Expand Down Expand Up @@ -273,7 +279,6 @@ export MAIN_MODULE_CFLAGS= $(CFLAGS_BASE) \
-mreference-types \
-I$(PYTHONINCLUDE) \
-I$(PYTHONINCLUDE)/.. \
-s EXCEPTION_CATCHING_ALLOWED=['we only want to allow exception handling in side modules']

.output_vars:
set
2 changes: 2 additions & 0 deletions docs/project/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ myst:

- ABI break: Upgraded Emscripten to 3.1.63 {pr}`5343` {pr}`5350` {pr}`5357`
{pr}`5334` {pr}`5363`
- ABI break: Switched to using WebAssembly exception handling for C++ errors,
Rust panics, and setjmp/longjmp. {pr}`5320`
Comment thread
hoodmane marked this conversation as resolved.
Outdated
- Added `jiter` 0.8.2 {pr}`5388`

### Packages
Expand Down
8 changes: 4 additions & 4 deletions packages/RobotRaconteur/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ requirements:
- numpy

build:
cxxflags: -fexceptions -fPIC -DBOOST_SP_DISABLE_THREADS=1 -O2
ldflags: -fexceptions
cxxflags: -fwasm-exceptions -fPIC -DBOOST_SP_DISABLE_THREADS=1 -O2
ldflags: -fwasm-exceptions
script: |
export INSTALL_DIR=${WASM_LIBRARY_DIR}

Expand All @@ -28,7 +28,7 @@ build:
-DNUMPY_INCLUDE_DIR=$HOSTINSTALLDIR/lib/python$PYMAJOR.$PYMINOR/site-packages/numpy/_core/include/ \
-DPYTHON3_INCLUDE_DIR=$PYTHONINCLUDE -DPYTHON3_EXECUTABLE=python$PYMAJOR.$PYMINOR \
-DPYTHON3_LIBRARY=$HOSTINSTALLDIR/lib/python$PYMAJOR.$PYMINOR.a \
-DCMAKE_CXX_FLAGS="-fPIC -fexceptions -DBOOST_AP_DISABLE_THREADS=1 -O2 -DBOOST_BIND_GLOBAL_PLACEHOLDERS=1" \
-DCMAKE_CXX_FLAGS="-fPIC -fwasm-exceptions -DBOOST_AP_DISABLE_THREADS=1 -O2 -DBOOST_BIND_GLOBAL_PLACEHOLDERS=1" \
-DBoost_INCLUDE_DIR=$WASM_LIBRARY_DIR/include -DBoost_LIBRARY_DIR=$WASM_LIBRARY_DIR/lib \
-DBoost_DATE_TIME_LIBRARY_RELEASE=$WASM_LIBRARY_DIR/lib/libboost_date_time.a \
-DBoost_DATE_TIME_LIBRARY_DEBUG=$WASM_LIBRARY_DIR/lib/libboost_date_time.a \
Expand All @@ -52,7 +52,7 @@ build:
-DCMAKE_VERBOSE_MAKEFILE=ON \
.
emmake make -j ${PYODIDE_JOBS:-3}
emcc ${SIDE_MODULE_LDFLAGS} -fexceptions out/lib/libRobotRaconteurCore.a \
emcc ${SIDE_MODULE_LDFLAGS} -fwasm-exceptions out/lib/libRobotRaconteurCore.a \
out/Python3/RobotRaconteur/_RobotRaconteurPython.a \
$WASM_LIBRARY_DIR/lib/libboost_chrono.a \
$WASM_LIBRARY_DIR/lib/libboost_date_time.a \
Expand Down
4 changes: 2 additions & 2 deletions packages/boost-cpp/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ build:
./b2 variant=release toolset=clang-emscripten link=static threading=single \
--with-date_time --with-filesystem \
--with-system --with-regex --with-chrono --with-random --with-program_options --disable-icu \
cxxflags="$SIDE_MODULE_CXXFLAGS -fexceptions -DBOOST_SP_DISABLE_THREADS=1" \
cflags="$SIDE_MODULE_CFLAGS -fexceptions -DBOOST_SP_DISABLE_THREADS=1" \
cxxflags="$SIDE_MODULE_CXXFLAGS -fwasm-exceptions -DBOOST_SP_DISABLE_THREADS=1" \
cflags="$SIDE_MODULE_CFLAGS -fwasm-exceptions -DBOOST_SP_DISABLE_THREADS=1" \
linkflags="-fpic $SIDE_MODULE_LDFLAGS" \
--layout=system -j"${PYODIDE_JOBS:-3}" --prefix=${INSTALL_DIR} \
install
Expand Down
6 changes: 3 additions & 3 deletions packages/casadi/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ requirements:
build:
exports: requested
cflags: |
-fexceptions -frtti
-fwasm-exceptions -frtti
cxxflags: |
-fexceptions -frtti
-fwasm-exceptions -frtti
ldflags: |
-fexceptions
-fwasm-exceptions
about:
home: http://casadi.org
PyPI: https://pypi.org/project/casadi
Expand Down
6 changes: 3 additions & 3 deletions packages/coolprop/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ source:
- ./pyproject.toml

build:
cflags: -fexceptions
cxxflags: -fexceptions
ldflags: -fexceptions
cflags: -fwasm-exceptions
cxxflags: -fwasm-exceptions
ldflags: -fwasm-exceptions

requirements:
run:
Expand Down
8 changes: 4 additions & 4 deletions packages/cpp-exceptions-test/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ source:
build:
type: shared_library
script: |
em++ ${SIDE_MODULE_CFLAGS} -fexceptions -I${PYTHONINCLUDE} -flto -fno-lto -std=c++20 -c throw.cpp -o throw.o
em++ ${SIDE_MODULE_CFLAGS} -fexceptions -I${PYTHONINCLUDE} -flto -fno-lto -std=c++20 -c catch.cpp -o catch.o -mreference-types
em++ ${SIDE_MODULE_LDFLAGS} -fexceptions -o ${DISTDIR}/cpp-exceptions-test-throw.so throw.o
em++ ${SIDE_MODULE_LDFLAGS} -fexceptions -o ${DISTDIR}/cpp-exceptions-test-catch.so catch.o
em++ ${SIDE_MODULE_CFLAGS} -fwasm-exceptions -I${PYTHONINCLUDE} -flto -fno-lto -std=c++20 -c throw.cpp -o throw.o
em++ ${SIDE_MODULE_CFLAGS} -fwasm-exceptions -I${PYTHONINCLUDE} -flto -fno-lto -std=c++20 -c catch.cpp -o catch.o -mreference-types
em++ ${SIDE_MODULE_LDFLAGS} -fwasm-exceptions -sSIDE_MODULE=1 -o ${DISTDIR}/cpp-exceptions-test-throw.so throw.o
em++ ${SIDE_MODULE_LDFLAGS} -fwasm-exceptions -sSIDE_MODULE=1 ${DISTDIR}/cpp-exceptions-test-throw.so -o ${DISTDIR}/cpp-exceptions-test-catch.so catch.o
about:
license: MPL-2.0
4 changes: 2 additions & 2 deletions packages/cpp-exceptions-test2/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package:
source:
path: src
build:
cxxflags: -fexceptions
ldflags: -fexceptions
cxxflags: -fwasm-exceptions
ldflags: -fwasm-exceptions
about:
license: MPL-2.0
7 changes: 4 additions & 3 deletions packages/gdal/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ build:

embuilder build zlib --pic
embuilder build libjpeg --pic
embuilder build libpng --pic
embuilder build libpng-wasm-sjlj --pic
embuilder build sqlite3 --pic

mkdir -p build
Expand Down Expand Up @@ -62,7 +62,7 @@ build:
\
-DGDAL_USE_PNG=ON \
-DPNG_PNG_INCLUDE_DIR=$EMSCRIPTEN_INCLUDE \
-DPNG_LIBRARY_RELEASE=$EMSCRIPTEN_LIB/libpng.a \
-DPNG_LIBRARY_RELEASE=$EMSCRIPTEN_LIB/libpng-wasm-sjlj.a \
\
-DGDAL_USE_JPEG=ON \
-DJPEG_INCLUDE_DIR=$EMSCRIPTEN_INCLUDE \
Expand All @@ -79,7 +79,8 @@ build:
-DGDAL_USE_JSONC_INTERNAL=ON \
-DGDAL_USE_PCRE2=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_PYTHON_BINDINGS=OFF
-DBUILD_PYTHON_BINDINGS=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON


# Note:
Expand Down
2 changes: 1 addition & 1 deletion packages/glpk/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source:
build:
type: static_library
script: |
CFLAGS="-fPIC" emconfigure ./configure \
CFLAGS="-fPIC -sSUPPORT_LONGJMP=wasm" LDFLAGS="-sSUPPORT_LONGJMP=wasm" emconfigure ./configure \
--prefix=${WASM_LIBRARY_DIR} \
--disable-dependency-tracking \
--disable-shared \
Expand Down
6 changes: 3 additions & 3 deletions packages/matplotlib/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ build:
-s USE_FREETYPE=1
-s USE_LIBPNG=1
-s USE_ZLIB=1
-fexceptions
-fwasm-exceptions
-fno-lto
cxxflags: |
-std=c++14
-fexceptions
-fwasm-exceptions
ldflags: |
-fexceptions
-fwasm-exceptions
script: export SETUPTOOLS_SCM_PRETEND_VERSION=$PKG_VERSION
post: |
rm -rf matplotlib/backends/qt_editor
Expand Down
2 changes: 1 addition & 1 deletion packages/opencv-python/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ build:
ldflags: |
-ljpeg
-lz
-lpng
-lpng-wasm-sjlj
# Note on CMAKE_ARGS:
# CMake args are adopted from OpenCV.js (https://github.com/opencv/opencv/blob/4.x/platforms/js/build_js.py)
# But we support more modules than OpenCV.js.
Expand Down
4 changes: 2 additions & 2 deletions packages/ppl/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ build:
emconfigure ./configure \
CFLAGS="-fPIC -Wno-reserved-identifier -Wno-reserved-macro-identifier" \
CPPFLAGS="-I${WASM_LIBRARY_DIR}/include" \
CXXFLAGS="-std=c++11 -fPIC -Wno-reserved-identifier -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-unsafe-buffer-usage -Wno-extra-semi-stmt -Wno-shadow -Wno-implicit-fallthrough -Wno-deprecated-literal-operator -Wno-suggest-override -Wno-suggest-destructor-override -Wno-deprecated-copy-with-user-provided-dtor -Wno-deprecated-copy-with-user-provided-copy -Wno-unused-template -Wno-comma -Wno-unreachable-code-return -Wno-deprecated-declarations -Wno-unreachable-code-break -Wno-format-nonliteral -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-weak-vtables -Wno-old-style-cast -Wno-header-hygiene -Wno-undef" \
LDFLAGS="-L${WASM_LIBRARY_DIR}/lib" \
CXXFLAGS="-fwasm-exceptions -std=c++11 -fPIC -Wno-reserved-identifier -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-unsafe-buffer-usage -Wno-extra-semi-stmt -Wno-shadow -Wno-implicit-fallthrough -Wno-deprecated-literal-operator -Wno-suggest-override -Wno-suggest-destructor-override -Wno-deprecated-copy-with-user-provided-dtor -Wno-deprecated-copy-with-user-provided-copy -Wno-unused-template -Wno-comma -Wno-unreachable-code-return -Wno-deprecated-declarations -Wno-unreachable-code-break -Wno-format-nonliteral -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-weak-vtables -Wno-old-style-cast -Wno-header-hygiene -Wno-undef" \
LDFLAGS="-L${WASM_LIBRARY_DIR}/lib -fwasm-exceptions -sSUPPORT_LONGJMP" \
--disable-dependency-tracking \
--enable-coefficients=mpz --disable-fpmath \
--enable-interfaces=c,c++ \
Expand Down
7 changes: 4 additions & 3 deletions packages/pygame-ce/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ build:
${SIDE_MODULE_LDFLAGS} \
-fPIC \
-lSDL2 \
-lSDL2_image-bmp-gif-jpg-png \
-lSDL2_image-bmp-gif-jpg-png-wasm-sjlj \
-lSDL2_ttf \
-lSDL2_mixer_mid-mod-mpg-ogg \
-lSDL2_gfx \
-lfreetype \
-lfreetype-wasm-sjlj \
-lharfbuzz \
-lpng \
-lpng-wasm-sjlj \
-ljpeg \
-lgif \
-lvorbis \
Expand All @@ -84,6 +84,7 @@ build:
-lhtml5 \
${STATIC_OBJS} \
${SHARED_LIBS} \
-sSUPPORT_LONGJMP=wasm \
-o pygame_static.so

# Remove duplicated static.so module
Expand Down
4 changes: 0 additions & 4 deletions packages/rust-panic-test/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package:
version: "1.0"
source:
path: src
build:
script: |
rustup toolchain install ${RUST_TOOLCHAIN} && rustup default ${RUST_TOOLCHAIN}
rustup target add wasm32-unknown-emscripten --toolchain ${RUST_TOOLCHAIN}
requirements:
executable:
- rustup
Expand Down
4 changes: 2 additions & 2 deletions packages/scipy/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ build:
-DUNDERSCORE_G77
-fvisibility=default
cxxflags: |
-fexceptions
-fwasm-exceptions
-fvisibility=default
ldflags: |
-L$(NUMPY_LIB)/core/lib/
-L$(NUMPY_LIB)/random/lib/
-fexceptions
-fwasm-exceptions

# Exclude tests via Meson's install tags functionality.
unvendor-tests: true
Expand Down
4 changes: 2 additions & 2 deletions packages/shapely/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ build:
script: |
export GEOS_CONFIG=${WASM_LIBRARY_DIR}/bin/geos-config
cxxflags: |
-fexceptions
-fwasm-exceptions
ldflags: |
-fexceptions
-fwasm-exceptions
requirements:
run:
- numpy
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ markers = [

[tool._pyodide]

[tool.pyodide.build]
rust_toolchain = "nightly-2025-01-15"

[tool.codespell]
ignore-words = 'tools/codespell_ignore_words.txt'
skip = 'benchmark/benchmarks/pystone_benchmarks/pystone.py,src/js/package-lock.json,tools/codespell_ignore_words.txt'
21 changes: 9 additions & 12 deletions src/core/error_handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ function ensureCaughtObjectIsError(e: any): Error {

class CppException extends Error {
ty: string;
constructor(ty: string, msg: string | undefined, ptr: number) {
constructor(
ty: string,
msg: string | undefined,
e: any /* WebAssembly.Exception */,
) {
// @ts-ignore
const ptr = Module.getCppExceptionThrownObjectFromWebAssemblyException(e);
if (!msg) {
msg = `The exception is an object of type ${ty} at address ${ptr} which does not inherit from std::exception`;
}
Expand All @@ -56,19 +62,10 @@ Object.defineProperty(CppException.prototype, "name", {
},
});

// As a fallback for when Wasm EH is not available, use an empty function.
// The fallback ensures instanceof always returns false.
const wasmException = (WebAssembly as any).Exception || function () {};
const isWasmException = (e: any) => e instanceof wasmException;
const WasmException = (WebAssembly as any).Exception;
const isWasmException = (e: any) => e instanceof WasmException;

function convertCppException(e: any) {
if (isWasmException(e)) {
if (e.is(Module.jsWrapperTag)) {
e = e.getArg(Module.jsWrapperTag, 0);
} else {
return e;
}
}
let [ty, msg]: [string, string] = Module.getExceptionMessage(e);
return new CppException(ty, msg, e);
}
Expand Down
Loading