pyo3_runtime.PanicException: internal error: entered unreachable code
Closed this issue · 3 comments
I ran into the following issue:
thread '<unnamed>' panicked at 'internal error: entered unreachable code', src/lib.rs:450:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "/Users/eliabieri/Library/Caches/pypoetry/virtualenvs/widget-4qY9vehV-py3.11/bin/componentize-py", line 8, in <module>
sys.exit(script())
^^^^^^^^
pyo3_runtime.PanicException: internal error: entered unreachable code
Steps to reproduce
Prerequisites: Poetry
- Clone repo
git clone --recurse-submodules git@github.com:eliabieri/wg_display_widget_py.git
- Install dependencies
poetry install
- Generate bindings
poetry run componentize-py --wit-path wg_display_widget_wit/wit --world widget bindings .
- Generate component
poetry run componentize-py --wit-path wg_display_widget_wit/wit --world widget componentize --output widget.wasm --python-path widget widget
Hi @eliabieri. Thanks for reporting this.
I just opened #32, which should fix the panic. I'll publish a 0.4.3 release with the fix soon.
Also, you'll need to rename widget/widget.py to something else (e.g. widget/app.py) because componentize-py
gets confused when there's two widget modules in the path (the one you wrote and the one that gets generated from widget.wit).
With both of the above changes, I was able to build the component successfully. I haven't tried running it yet, since I'm not sure how to set up the appropriate host environment. If you have trouble with that, please let me know how to reproduce it, and I'll be happy to help debug.
One more thing: you might need to add a from widget import types
line to your code. See https://github.com/bytecodealliance/componentize-py#known-limitations for details.