-
Notifications
You must be signed in to change notification settings - Fork 748
PythonNET unknown kwargs being discarded #2360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@filmor @dmitry-medvedev @lstratman @henon @slide i will like to work on this issue |
@balogun14 Great. The function that is probably buggy is https://github.com/pythonnet/pythonnet/blob/master/src/runtime/MethodBinder.cs#L372. |
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. |
Let's just see what comes out of it. We can always introduce flags that could be set at init/load-time. |
@filmor would you really double our testing matrix for this? |
Environment
Details
When accessing a .NET function using PythonNET, if a kwarg is incorrect or doesn’t exist, it is discarded by the PythonNET execution engine
If I have a .NET function like this:
And I call it in PythonNET like this:
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.
PythonDemo.zip
The text was updated successfully, but these errors were encountered: