Replies: 1 comment
-
That seems like a good rationale and I think if we do commit to #3646 which would change the API for
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I encountered recently the issue of needing
allow_threads
inDrop
implementation. It forces me to writePython::with_gil(|gil| gil.allow_threads(|| {...}))
.In the context of Python code executing the drop, this is fine, because the GIL will already be acquired, but if my object is somehow used in Rust code, dropping it will require acquiring the GIL while it's completely useless (and can cause performance issues)
Maybe PyO3 could expose some
allow_threads
free function, which will not try to acquire the GIL, just check that it's not acquired or release it if needed.I didn't open a issue because I don't need this feature myself, as my objects should not be used in Rust code, but this feature may interest you, especially as it is quite easy to implement (and you know I'm always volunteer to do it myself if needed.).
Beta Was this translation helpful? Give feedback.
All reactions