allow from_py_with on function args to take a fn(&Bound) -> PyResult#3837
allow from_py_with on function args to take a fn(&Bound) -> PyResult#3837davidhewitt merged 1 commit intoPyO3:mainfrom
from_py_with on function args to take a fn(&Bound) -> PyResult#3837Conversation
CodSpeed Performance ReportMerging #3837 will degrade performances by 15.63%Comparing Summary
Benchmarks breakdown
|
davidhewitt
left a comment
There was a problem hiding this comment.
Thanks, that was straightforward!
There is still a lot of old APIs surrounding this, but it might be better to tackle them separately.
If you mean the rest of extract_argument, I've got pretty much all of it in #3708. That's just blocked on #3802 and then I think it's finally mergeable. I'll try to update #3802 tonight, if my toddler ever settles down for bed... 🙃
| @@ -20,7 +20,7 @@ impl<'a, T> From<fn(&'a PyAny) -> PyResult<T>> for Extractor<'a, '_, T> { | |||
| } | |||
|
|
|||
| impl<'a, 'py, T> Extractor<'a, 'py, T> { | |||
There was a problem hiding this comment.
Given that Extractor should be just temporary code which we'll remove again when the GIL Ref API is dead and gone, I'm fine with leaving it here for now 👍
Part of #3684
This allows the
#[pyfunction]and#[pymethod]arguments to useBoundAPI extractors in#[pyo3(from_py_with = ...)]. I reused the internalExtractorimplementation that I recently introduced in #3828. For now I left it where I added it initially, but if we like to move it to a different place or module, I can do that.There is still a lot of old APIs surrounding this, but it might be better to tackle them separately.