The fake arg is discarded, and no error or exception is thrown. Python compiles as if the additional kwarg were not there. In this situation, normal Python would be throwing a TypeError.
This is an issue with a multiple kwargs in the methods/functions is that a user can easily misspell and result in unexpected behavior.
I am nearly sure this will have to stay this way until the next major version, because fixing it may break code that relied on discarding of unused kwargs (which is the default behavior of Python in case kwargs argument is present).
There's also a descent chance that there are certain scenarios where strict behavior like requested would make implementation hard or even impossible, but I can't remember anything on the spot.
Activity
balogun14 commented on Oct 7, 2024
@filmor @dmitry-medvedev @lstratman @henon @slide i will like to work on this issue
filmor commented on Oct 7, 2024
@balogun14 Great. The function that is probably buggy is https://github.com/pythonnet/pythonnet/blob/master/src/runtime/MethodBinder.cs#L372.
lostmsu commented on Oct 7, 2024
I am nearly sure this will have to stay this way until the next major version, because fixing it may break code that relied on discarding of unused kwargs (which is the default behavior of Python in case kwargs argument is present).
There's also a descent chance that there are certain scenarios where strict behavior like requested would make implementation hard or even impossible, but I can't remember anything on the spot.
filmor commented on Oct 7, 2024
Let's just see what comes out of it. We can always introduce flags that could be set at init/load-time.
lostmsu commented on Oct 18, 2024
@filmor would you really double our testing matrix for this?