-
Notifications
You must be signed in to change notification settings - Fork 804
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
Incorrect #[cfg] before PyEval_InitThreads breaks Python::acquire_gil() in standalone scripts on <= 3.6 #219
Comments
Actually, the issue is probably that the Although it seems like Python 3.7 survives a call to |
Thank you for this great bug report! The problem is indeed that the cfg isn't set so doesn't get called Why Python 3.7 works is explained in the c-api docs:
This means you can still call I've fixed this 10ef6cd by moving the call into pyo3. Just adding |
Which contains the fix for PyO3/pyo3#219 Add and test example scripts
🐛 Bug Reports
When reporting a bug, please provide the following information. If this is not a bug report you can just discard this template.
🌍 Environment
venv
.rustc --version
):rustc 1.30.0-nightly (2d4e34ca8 2018-09-09)
💥 Reproducing
Check out the code in the fork at https://github.com/joar/pyo3/tree/bug/pyeval-threadsnotinitialized/examples/verify_gil.
cd examples/verify_gil
if you haven't already
Note: Importing the script via ipython still works. I supect that is because some other extension that ipython uses calls
PyEval_InitThreads
.🎉 Solution?
It think that
#[cfg(py_sys_config = "WITH_THREAD")]
always is false even ifbuild.rs
setscargo:rustc-cfg=py_sys_config="WITH_THREAD"
. I think the solution might be to just change to#[cfg(not(Py_3_7))]
.The text was updated successfully, but these errors were encountered: