-
Notifications
You must be signed in to change notification settings - Fork 806
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
set_item consumes, but uses ToPyObject instead of IntoPyObject #480
Comments
Also set_item borrows mutates the dict. Should it borrow mutable? |
@PetrGlad No, that's unreleated, and on purpose. Python objects can always have multiple owners, so Rust's |
Marking to evaluate this as part of possible collections improvements for 0.15. |
@davidhewitt What would be the change here? I played a bit (tried changing ToPyObject -> IntoPy) and got into some errors. Is this supposed to be a tricky thing to solve? |
Changing to |
Finally solved by the new |
PyDict::set_item
consumes the key and value, but usesToPyObject
. Shouldn't that beIntoPyObject
?For
ToPyObject
, taking a reference would be sufficient. But it seems more efficient to consume and useIntoPyObject
.(Same for
PyList::set_item
, etc.)The text was updated successfully, but these errors were encountered: