Skip to content

Commit

Permalink
add missing annotation to PyCounter.__call__
Browse files Browse the repository at this point in the history
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'`.
  • Loading branch information
gertjanvanzwieten committed Nov 15, 2021
1 parent 3044bd9 commit 0e40277
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion guide/src/class/protocols.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl PyCounter {
fn __new__(wraps: Py<PyAny>) -> Self {
PyCounter { count: 0, wraps }
}

#[args(args="*", kwargs="**")]
fn __call__(
&mut self,
py: Python,
Expand Down

0 comments on commit 0e40277

Please sign in to comment.