-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Pyo3 update #70
Pyo3 update #70
Conversation
Thank you @awestlake87 for this! ✨ Do the changes even work with |
The 0.14 API is pretty different from 0.13, so it won't work with both. If you need it to work with both 0.13 and 0.14, you can delay this PR and continue using the 0.13 API with |
@awestlake87 , no no. I was asking as the Cargo.toml was not updated. I will update it and check if the tests pass. |
@awestlake87 , what does |
It allows the conversions to get a reference to the current event loop via task-local data. I've got a breakdown of its motivation and usage here |
More specifically;
This helps with subsequent calls to work with the event loop (such as acquiring python, or spawning other tasks) |
Co-authored-by: Andrew J Westlake <[email protected]>
Co-authored-by: Andrew J Westlake <[email protected]>
Co-authored-by: Andrew J Westlake <[email protected]>
Hey, the fix was a bit more complicated than I anticipated. Essentially, since you're using
run_forever
, there was no way of getting the event loop reference viaget_running_loop
as opposed toget_event_loop
(which will fetch the global event loop). I went ahead and scoped the event loop for yourindex
handler so that it has access to the event loop via task-local data.I've been improving the docs on 0.14, but this problem probably isn't explicitly addressed. The "Event Loop References and Thread-Awareness" section in the docs may provide some intuition for why 0.14 acts this way.