Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PythonNET unknown kwargs being discarded #2360

Open
Labels
@dmitry-medvedev

Description

@dmitry-medvedev

Environment

  • Pythonnet version: 3.0.3
  • Python version: 3.11
  • Operating System: Windows 10
  • .NET Runtime: .NET 8.0

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:

PublicFunctionSomeFunction(nameasString,ageasString)asStringReturn $"{name} - {age}"EndFunction

And I call it in PythonNET like this:

if__name__=="__main__":name="John"age="3"SomeFunction(name,age=age,fake_arg="something")

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp