ee89b2e8e2
* deprecate `wrap_pyfunction` with `py` argument The Python token in `wrap_pyfunction` is not handled automatically by `WrapPyFunctionArg`, for backwards compatibility. This uses deref specialization to deprecate this variant. * merge `Extractor`s * add deprecation ui test, revert closure variant due to test failure * fix nightly
26 lines
525 B
Rust
26 lines
525 B
Rust
#![cfg(feature = "macros")]
|
|
|
|
use pyo3::{prelude::*, types::PyCFunction};
|
|
|
|
#[pyfunction]
|
|
fn f() {}
|
|
|
|
pub fn add_wrapped(wrapper: &impl Fn(Python<'_>) -> PyResult<&PyCFunction>) {
|
|
let _ = wrapper;
|
|
}
|
|
|
|
#[test]
|
|
fn wrap_pyfunction_deduction() {
|
|
#[allow(deprecated)]
|
|
add_wrapped(wrap_pyfunction!(f));
|
|
}
|
|
|
|
pub fn add_wrapped_bound(wrapper: &impl Fn(Python<'_>) -> PyResult<Bound<'_, PyCFunction>>) {
|
|
let _ = wrapper;
|
|
}
|
|
|
|
#[test]
|
|
fn wrap_pyfunction_deduction_bound() {
|
|
add_wrapped_bound(wrap_pyfunction_bound!(f));
|
|
}
|