Does pyo3 automatically release GIL if py is not used or do you have to do this manually? #3621
-
Quick question. I've been looking at code of a python package. Code is fairly simple and it's here: https://github.com/mgd020/mjml-python/blob/master/src/lib.rs One thing I don't understand about PyO3: given that mjml2html doesn't hold any references to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The linked code with hold the GIL for the whole duration of the call. If you want to release it, you to do so manually by calling (We are working an a function attribute |
Beta Was this translation helpful? Give feedback.
The linked code with hold the GIL for the whole duration of the call. If you want to release it, you to do so manually by calling
allow_threads
.(We are working an a function attribute
#[pyo3(allow_threads)]
in #3610 to do this automatically, but that code is neither merged nor released yet.)