2021-12-03 00:03:32 +00:00
|
|
|
#![cfg(feature = "macros")]
|
|
|
|
|
2021-06-24 14:18:48 +00:00
|
|
|
use pyo3::{prelude::*, types::PyCFunction};
|
2021-05-06 13:58:45 +00:00
|
|
|
|
|
|
|
#[pyfunction]
|
|
|
|
fn f() {}
|
|
|
|
|
2024-05-10 17:03:57 +00:00
|
|
|
#[cfg(feature = "gil-refs")]
|
2022-03-23 07:07:28 +00:00
|
|
|
pub fn add_wrapped(wrapper: &impl Fn(Python<'_>) -> PyResult<&PyCFunction>) {
|
2021-05-06 13:58:45 +00:00
|
|
|
let _ = wrapper;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn wrap_pyfunction_deduction() {
|
2024-03-12 22:57:03 +00:00
|
|
|
#[allow(deprecated)]
|
2024-05-10 17:03:57 +00:00
|
|
|
#[cfg(feature = "gil-refs")]
|
2021-05-06 13:58:45 +00:00
|
|
|
add_wrapped(wrap_pyfunction!(f));
|
2024-05-10 17:03:57 +00:00
|
|
|
#[cfg(not(feature = "gil-refs"))]
|
|
|
|
add_wrapped_bound(wrap_pyfunction!(f));
|
2021-05-06 13:58:45 +00:00
|
|
|
}
|
2024-02-27 19:19:52 +00:00
|
|
|
|
|
|
|
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));
|
|
|
|
}
|