From 0e4027711233e021f1f868de20ed9c237795d614 Mon Sep 17 00:00:00 2001 From: Gertjan van Zwieten Date: Mon, 15 Nov 2021 09:01:05 +0100 Subject: [PATCH] add missing annotation to PyCounter.__call__ This patch annotates the `__call__` method of `PyCounter` in example: callable objects with `#[args(args="*", kwargs="**")]`. Without it (at least in PyO3 0.15.0) the example fails with `TypeError: counter.__call__() missing 1 required positional argument: 'args'`. --- guide/src/class/protocols.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/class/protocols.md b/guide/src/class/protocols.md index cc3e11c3689..d8dcda1cd9a 100644 --- a/guide/src/class/protocols.md +++ b/guide/src/class/protocols.md @@ -98,7 +98,7 @@ impl PyCounter { fn __new__(wraps: Py) -> Self { PyCounter { count: 0, wraps } } - + #[args(args="*", kwargs="**")] fn __call__( &mut self, py: Python,