* expanded freelist docs
* added check_signals doc example
* added doc examples for pyany methods
* doc examples for pymodule + deprecate add_wrapped
* fixed tabs+whitespace...
* stronger wording on running signal handler code
Co-authored-by: Georg Brandl <georg@python.org>
* fix keyboardinterrupt spelling
Co-authored-by: Georg Brandl <georg@python.org>
* remove semicolon
Co-authored-by: Georg Brandl <georg@python.org>
* add space
Co-authored-by: Georg Brandl <georg@python.org>
* add space
Co-authored-by: Georg Brandl <georg@python.org>
* added suggested changes
* fixed doctest
* fixed triple backslash
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* spacing inside struct
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* use ? rather than unwrap in doc examples
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* remove use of "we", "us", "you" from docs
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* add that freelist shouldnt be impl'd by users
* added suggested changes
Co-authored-by: Georg Brandl <georg@python.org>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
The change to wrap_pyfunction!() in #1143 makes it impossible to
implement `context.add_wrapped(wrap_pyfunction!(something))` in
`inline-python`.
`context` does not carry the GIL lifetime, which causes type deduction
trouble now that `wrap_pyfunction` results in a generic function.
```
error[E0308]: mismatched types
--> examples/rust-fn.rs:12:4
|
12 | c.add_wrapped(wrap_pyfunction!(rust_print));
| ^^^^^^^^^^^ one type is more general than the other
|
= note: expected enum `Result<&pyo3::types::PyCFunction, _>`
found enum `Result<&pyo3::types::PyCFunction, _>`
```
By re-wrapping the function as a closure, we trigger 'closure signature
deduction' when passing `wrap_pyfunction!()` as an argument to a
function: Rustc will deduce the signature of the closure from the
function that closure is passed to. This way, the generic arguments can
be deduced in more contexts, fixing the problem.