Skip to content

Regarding extraction from &PyAny (or PyObject) to Rust object #3940

Discussion options

You must be logged in to vote

The problem is that in the example you give above, 'source is a lifetime limited to inside the with_gil closure.

To avoid this, either pass py: Python<'source> as an argument, or use O: for<'a> FromPyObject<'a> + Clone as the bound, which will limit the function to types which don't capture the FromPyObject lifetime in their output.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@minsungkim-qraft
Comment options

Answer selected by minsungkim-qraft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants