Skip to content

pyo3-asyncio & references #4235

Closed Answered by davidhewitt
diliop asked this question in Questions
Jun 5, 2024 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Sorry for the slow reply. The general problem here is that extraction of data from Python types will need the py token to pull the data out safely, but in cases like strings the immutability on the Python side means we don't actually need to have the py token once we've done the extraction.

If you're using pyo3-asyncio, that presumably means you're still on PyO3 0.20 and the .extract() function for &str will tie the &str to the lifetime of py unnecessarily. After migrating off the gil-refs API in 0.21, that connection is broken but instead you will be borrowing from input which leads to similar complications.

Fortunately in PyO3 0.21 we also added PyBackedStr which fit exactly what you ne…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@diliop
Comment options

@davidhewitt
Comment options

@diliop
Comment options

@davidhewitt
Comment options

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