You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what PyToken is supposed to serve as a proof of, exactly, but in any case, it is possible to own one without a hold on the GIL. The following code segfaults on my machine.
Cargo.toml
[package]
authors = ["Michael Lamparski <diagonaldevice@gmail.com>"]
name = "token"version = "0.1.0"
[dependencies]
pyo3 = { version = "0.2.3" }
src/main.rs
#![feature(proc_macro, specialization)]externcrate pyo3;use pyo3::prelude::*;#[py::class]structDummy{}fnmain(){// Temporarily acquire the GIL and save the tokenletmut evil = None;Python::acquire_gil().python().init(|token| {
evil = Some(token);Dummy{}}).unwrap();let token = evil.unwrap();// Use python without acquiring the GIL
token.py().import("sys").unwrap();}
The text was updated successfully, but these errors were encountered:
I'm not sure what
PyToken
is supposed to serve as a proof of, exactly, but in any case, it is possible to own one without a hold on the GIL. The following code segfaults on my machine.Cargo.toml
src/main.rs
The text was updated successfully, but these errors were encountered: