-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
PyO3: complete Bound
migration and disable gil-refs
feature on pyo3
crate
#21499
PyO3: complete Bound
migration and disable gil-refs
feature on pyo3
crate
#21499
Conversation
@@ -153,12 +156,19 @@ impl AddressInput { | |||
_cls: &Bound<'_, PyType>, | |||
spec: &str, | |||
description_of_origin: &str, | |||
relative_to: Option<&str>, |
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.
These changes from &str
to String
are necessiated by the &str
lifetime when extracted no longer lasting as long as the 'py
GIL lifetime. See the discussion in the PyO3 migration guide for how to deal with this change.
The guide advises to use the new PyBackedStr
instead of &str
but in this method the &str
lifetime was complex enough to warrant just extracting an owned String
.
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'm assuming we don't expect the allocation overhead to be user-noticeable?
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 didn't get far enough to consider that since I plan to find a way to use references again. The code was encountering "fun" error messages as I tried to sort out the lifetimes for the references. Easier to do this and get the upgrade done first and then come back to this function with PyO3 v0.22 in place and have a focused PR to do it the right way.
This PR stacks on top of #21498 which should be reviewed first. |
@@ -153,12 +156,19 @@ impl AddressInput { | |||
_cls: &Bound<'_, PyType>, | |||
spec: &str, | |||
description_of_origin: &str, | |||
relative_to: Option<&str>, |
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'm assuming we don't expect the allocation overhead to be user-noticeable?
Complete the migration to the
pyo3::Bound
smart pointer and disable thegil-refs
feature on thepyo3
crate so any use of the "GIL refs" API will be flagged as a deprecation (which our source will error for).