Closed virtuald closed 1 year ago
FWIW, I don't exactly understand why this is possible. The type caster for std::function
doesn't... oh, the problem is that it accepts None
as a valid argument and converts it to an empty function. Womp.
Here's how we do it: https://pybind11.readthedocs.io/en/stable/advanced/functions.html#allow-prohibiting-none-arguments. It is a weird footgun that it allows None by default.
Fixed in 2023.3.2.2
Easy reproducer:
The actual situation where this occurred was when one of our examples called a function instead of using a lambda: