-
Notifications
You must be signed in to change notification settings - Fork 760
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
Write migration guide #795
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A migration guide is a really good idea. This is really well written and has lots of good examples!
I made some suggestions to small bits of the wording.
@davidhewitt |
guide/src/migration.md
Outdated
@@ -42,10 +42,11 @@ For more, see [the constructor section](https://pyo3.rs/master/class.html#constr | |||
PyO3 0.9 introduces [`PyCell`](https://pyo3.rs/master/doc/pyo3/pycell/struct.PyCell.html), which is | |||
a [`RefCell`](https://doc.rust-lang.org/std/cell/struct.RefCell.html) like object wrapper | |||
for dynamically ensuring | |||
[Rust's rule of Reference](https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#the-rules-of-references). | |||
[Rust's rules of references](https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#the-rules-of-references). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be more explicit and say "rules regarding aliasing of references".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but I want to use the same expression as the rustbook here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I just don't think "the rules of references" is a standing term in the community. I wouldn't immediately know what it refers to until clicking the link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not have both and write something like
RefCell-like object wrapper for ensuring Rust's rules regarding aliasing of references are upheld.
For more detail, see the
[Rust Book's section on Rust's rules of references](https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#the-rules-of-references)
Co-Authored-By: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
Co-Authored-By: Georg Brandl <georg@python.org>
Pushed some changes for rust-numpy. |
guide/src/migration.md
Outdated
|
||
### PyCell | ||
PyO3 0.9 introduces [`PyCell`](https://pyo3.rs/master/doc/pyo3/pycell/struct.PyCell.html), which is | ||
a [`RefCell`](https://doc.rust-lang.org/std/cell/struct.RefCell.html) like object wrapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a [`RefCell`](https://doc.rust-lang.org/std/cell/struct.RefCell.html) like object wrapper | |
a [`RefCell`](https://doc.rust-lang.org/std/cell/struct.RefCell.html)-like object wrapper |
fn as_ref(&self, _py: Python) -> &PyCell<T> { | ||
impl<T> AsPyRef for Py<T> | ||
where | ||
T: PyTypeInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Cargo.toml
Outdated
num-bigint = { version = ">= 0.2", optional = true } | ||
num-complex = { version = ">= 0.2", optional = true } | ||
num-traits = "0.2.8" | ||
indoc = "^0.3.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
is the default operator, this doesn't change anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I misunderstood that it is equal to "=="
I decided to merge this PR now and will open a separate PR for the release for other PRs to sync with the master easier. |
Resolves #785
I wrote a migration guide in Appendix B of the guide.
Now only pushed the migration guide, but I'm going to use this branch for the release.