Skip to content

Interior Mutability #4418

Closed Answered by birkenfeld
MatthewMckee4 asked this question in Questions
Aug 5, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Your solution is correct, in general it is impossible to give out references to inner objects if they aren't wrapped in a Py pointer. This is because once a reference is in Python land, it can be copied and shared arbitrarily, and the Rust side can't track that. Arc would be a solution for Rust-only code, and Py is the equivalent here.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@davidhewitt
Comment options

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