From 5c828e5b5fdf41f2e25c5a6987d012ba424e039c Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 30 Apr 2026 14:41:39 +0100 Subject: [PATCH] ci: fix `Callable[]` type hint on 3.8 --- src/macros.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index ddf82413db5..56ba7e6870e 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -149,17 +149,19 @@ macro_rules! py_run_impl { /// let example = PyModule::from_code( /// py, /// c"from collections.abc import Callable -/// def add_two_and_three(add: Callable[[int, int], int]) -> int: +/// def add_two_and_three(add: 'Callable[[int, int], int]') -> int: /// return add(2, 3)", /// c"example.py", /// c"", /// )?; /// +/// // `add_two_and_three` is a Python function defined in the code above /// let add_two_and_three = example.getattr("add_two_and_three")?; /// -/// let result = add_two_and_three -/// .call1((wrap_pyfunction!(add, example)?,))? -/// .extract::()?; +/// // `add` is a Python function defined by the `#[pyfunction]` macro +/// let add = wrap_pyfunction!(add, py)?; +/// +/// let result = add_two_and_three.call1((add,))?.extract::()?; /// /// assert_eq!(result, 5); ///