-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make rustpython-vm compatible with non-js wasm32-unknown & add tests #4211
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if skipping cargo check --target wasm32-unknown-unknown --no-default-features
is safe.
other parts looks great
@@ -102,6 102,11 @@ mod time { | |||
Ok(Date::now() / 1000.0) | |||
} | |||
|
|||
#[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will need a way to implement time, I have the APIs in my environment, but I will need a way to override this
@@ -53,6 53,11 @@ impl VirtualMachine { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be useful
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.