deprecate IntoPy in favor or IntoPyObject#4618
Conversation
|
Thanks for getting on with the first two points already.
Agreed, I think we can just make that change and leave it infallible for now 👍 To avoid chance of racing, can I leave that PR for you to complete? I think it shouldn't conflict with the other error changes I'm working on in e.g. #4655 and later PRs... |
Sure, I opened #4660 with that. |
d3b0667 to
80c92d4
Compare
80c92d4 to
f9d39e4
Compare
f9d39e4 to
ff7cb80
Compare
davidhewitt
left a comment
There was a problem hiding this comment.
Thanks, this looks good to me!
I still see a lot of .map(BoundObject::into_any) and the like, I suspect we will add an IntoPyObjectExt trait with some methods like .into_pyresult_pyobject(). That is probably something to follow up after 0.23 at this point.
| CompareOp::Eq => (self.0 == other.0).into_py(py), | ||
| CompareOp::Ne => (self.0 != other.0).into_py(py), | ||
| _ => py.NotImplemented(), | ||
| CompareOp::Eq => Ok((self.0 == other.0).into_pyobject(py)?.into_any()), |
There was a problem hiding this comment.
Does this work to get to PyObject? It might be a touch simpler for users to understand.
| CompareOp::Eq => Ok((self.0 == other.0).into_pyobject(py)?.into_any()), | |
| CompareOp::Eq => Ok((self.0 == other.0).into_pyobject(py)?.into()), |
There was a problem hiding this comment.
No, currently it does not.
There was a problem hiding this comment.
I think interestingly #4593 might help here. But again an improvement for after 0.23
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Icxolu
left a comment
There was a problem hiding this comment.
Thanks for the review 🚀
I still see a lot of
.map(BoundObject::into_any)and the like, I suspect we will add anIntoPyObjectExttrait with some methods like.into_pyresult_pyobject(). That is probably something to follow up after 0.23 at this point.
Yeah, in generic code this comes up a lot. A IntoPyObjectExt could be nice if we can find good names for the methods. I agree that we can postpone this to after 0.23.
| CompareOp::Eq => (self.0 == other.0).into_py(py), | ||
| CompareOp::Ne => (self.0 != other.0).into_py(py), | ||
| _ => py.NotImplemented(), | ||
| CompareOp::Eq => Ok((self.0 == other.0).into_pyobject(py)?.into_any()), |
There was a problem hiding this comment.
No, currently it does not.
CodSpeed Performance ReportMerging #4618 will improve performances by 15.84%Comparing Summary
Benchmarks breakdown
|
This deprecates
IntoPyin favor ofIntoPyObject. There are 3 blockers left:IntoPy::type_outputfromfeature = "experimental-inspect"? Do we just transfer it ontoIntoPyObject? moveIntoPy::type_outputtoIntoPyObject::type_output#4657IntoPyfor the vectorcall enhancement of Use vectorcall (where possible) when calling Python functions #4456. The plan was to split this out into somePyCallArgstrait. Maybe we want to target 0.24 for that and revert to the simple approach for now? migratecallAPI toIntoPyObject#4653PyErrArgumentshas a blanket forIntoPy<PyAny>which we probably should migrate toIntoPyObject. Its method should probably become fallible, but maybe we can justunwrapthere for now and tackle this in a later release (maybe along side with "lazy" state ofPyErr... has challenges #4584) switchPyErrArgumentsblanket impl toIntoPyObject#4660