pybind11
pybind11 copied to clipboard
Manually defining a class via attributes does not allow for passing kwargs
The recommended method of creating a subclass from https://github.com/pybind/pybind11/issues/1193#issuecomment-429451094 does not seem to allow for passing keyword arguments.
This test fails with:
def test_kw_only():
> assert (m.KwOnlyMethod().test("x", y="y") == 0)
E TypeError: (): incompatible function arguments. The following argument types are supported:
E 1. (x: object, *, y: object, arg1: object) -> int
E
E Invoked with: <importlib._bootstrap.MwOnlyMethod object at 0x11029e900>, 'x'; kwargs: y='y'
../../../../tests/test_class.py:507: TypeError