Open
Description
It allows smuggling Python types into the closure:
use pyo3::prelude::*;
use pyo3::types::PyString;
use send_wrapper::SendWrapper;
fn main() {
Python::with_gil(|py| {
let string = PyString::new(py, "foo");
let wrapped = SendWrapper::new(string);
py.allow_threads(|| {
let smuggled: &PyString = *wrapped;
println!("{:?}", smuggled);
});
});
}
Results in
error: process didn't exit successfully: target\debug\my_module.exe (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
So I'm not sure whose fault it is:
- Ours, for using
Send
for something it wasn't meant to. send_wrapper
's, for assuming others didn't put arbitrary restrictions onSend
.