Make rustpython-vm compatible with non-js wasm32-unknown & add tests#4211
Make rustpython-vm compatible with non-js wasm32-unknown & add tests#4211coolreader18 wants to merge 4 commits intoRustPython:mainfrom
Conversation
dff54cd to
9199599
Compare
|
Hmm, is there a reason we need to have wasm32-unknown-unknown checked in exotic_targets when we have the wasm job? Is that a holdover from before we had the wasm job? |
cd74d27 to
e00c1f2
Compare
|
I recently added it there without specific reason. Do you think it belongs to wasm job? That makes sense. |
| @@ -0,0 +1 @@ | |||
| A test crate to ensure that `rustpython-vm` compiles on `wasm32-unknown-unknown` without a JS host. | |||
|
As far as I can tell compilation for the target is already tested fully on the wasm job, so it's redundant in exotic_targets. |
|
I added the build to prevent the target's build error. wasm build job was not fully covering the top-most crate rustpython build |
|
Oh, I see. But that's not supported anyway, right? You can't compile a cli application to wasm w/ js-interop, there's no syscalls or argv or anything. |
|
there was wasm32-unknown use case without js interop. |
|
cc @lastmjs |
youknowone
left a comment
There was a problem hiding this comment.
not sure if skipping cargo check --target wasm32-unknown-unknown --no-default-features is safe.
other parts looks great
|
|
||
| #[cfg(all(target_arch = "wasm32", not(feature = "js"), not(target_os = "wasi")))] | ||
| fn _time(vm: &VirtualMachine) -> PyResult<f64> { | ||
| Err(vm.new_not_implemented_error("time.time".to_owned())) |
There was a problem hiding this comment.
I will need a way to implement time, I have the APIs in my environment, but I will need a way to override this
| error(&s); | ||
| panic!("{}; exception backtrace above", msg) | ||
| } | ||
| #[cfg(all(target_arch = "wasm32", not(feature = "js"), not(target_os = "wasi")))] |
There was a problem hiding this comment.
Wouldn't it be useful to still see information from the exception? Can't you do something like:
let err_string: String = exc.to_pyobject(vm).repr(vm).unwrap().to_string();Or does the msg have everything we need?
584a52d to
e03d5da
Compare
e03d5da to
41730a6
Compare
41730a6 to
4daf857
Compare
b06655e to
17abc0f
Compare
Ideally the test crate shouldn't take long to compile, since it's the same target with only a few crates configured differently.