-
-
Notifications
You must be signed in to change notification settings - Fork 290
PyO3 Migration from v0.20.* to 0.24.* #1168
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bro i get warnings and in that i get the link to this guide https://pyo3.rs/v0.23.0/migration this PR is to migrate from v0.20 to v0.21 but you upgrade it to v0.24, that's why so many warnings and error came, try to read all the migration guide carefully if you are trying to upgrade to latest version, i think which is 1.24 This is the reason, i got the migration guide link in warning when compiling the file
|
there are many errors but i removed same types of error occuring again & again, for more info see the log file i am attaching |
|
88c9e20
to
392c2f3
Compare
392c2f3
to
7681ae5
Compare
okay, so the code compiles now & can handle a request successfully. but, a lot of stuff are still broken & the tests don't pass. one of the main issues currently is the inability to clone I am searching for a better way to do this; my intuition tells that there must be a better way to do this, rather than to introduce this extra overhead. if you are reading this & have a better solution, please LMK in a comment below! :) cc @k4976 |
73cb007
to
6b4efac
Compare
|
1 similar comment
|
where | ||
T: ToPyObject, | ||
{ | ||
let handler = function.handler.as_ref(py); | ||
let kwargs = function.kwargs.as_ref(py); | ||
let handler = function.handler.bind(py).downcast()?; |
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.
Potential unhandled error case with downcast. The original code using as_ref() didn't require type checking, but the new code assumes the type can be downcast. If the type doesn't match expectations, it will fail at runtime. Need to add proper error handling or type verification.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
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.
@VishnuSanal , what do you think 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.
this is still PyAny
-- we can do the following if we want. but I feel like it would be a redundant & introduce unnecessary complexity. what do you think @sansyrox?
let handler = function.handler.bind(py).downcast::<pyo3::types::PyAny>()
.map_err(|_| PyErr::new::<pyo3::exceptions::PyTypeError, _>(
"Wrong type found for function.handler",
))?;
this is still handled gracefully anyways
Err(e) => {
error!(
"Error while executing route function for endpoint `{}`: {}",
req.uri().path(),
get_traceback(&e)
);
Response::internal_server_error(None)
}
😱 Found 4 issues. Time to roll up your sleeves! 😱 |
CodSpeed Performance ReportMerging #1168 will not alter performanceComparing Summary
|
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.
@VishnuSanal , all looks good. Have some questions
Looks good to me! Waiting for recurse to update. |
@recurseml re-review |
|
1 similar comment
|
✨ No issues found! Your code is sparkling clean! ✨ |
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.
LGTM! Love it
Description
This PR fixes #1167
Summary
This PR does PyO3 Migration from v0.20.* to 0.24.*
PR Checklist
Please ensure that:
Pre-Commit Instructions: