Title: PythonNET unknown kwargs being discarded · Issue #2360 · pythonnet/pythonnet · GitHub
Open Graph Title: PythonNET unknown kwargs being discarded · Issue #2360 · pythonnet/pythonnet
X Title: PythonNET unknown kwargs being discarded · Issue #2360 · pythonnet/pythonnet
Description: 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 Python...
Open Graph Description: 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 does...
X Description: 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 does...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/2360
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PythonNET unknown kwargs being discarded ","articleBody":"### Environment\r\n\r\n- Pythonnet version: 3.0.3\r\n- Python version: 3.11\r\n- Operating System: Windows 10\r\n- .NET Runtime: .NET 8.0\r\n\r\n### Details\r\nWhen accessing a .NET function using PythonNET, if a kwarg is incorrect or doesn’t exist, it is discarded by the PythonNET execution engine\r\n\r\nIf I have a .NET function like this:\r\n\r\n```vb\r\nPublic Function SomeFunction(name as String, age as String) as String\r\n Return $\"{name} - {age}\"\r\nEnd Function\r\n```\r\n\r\nAnd I call it in PythonNET like this:\r\n\r\n```python\r\nif __name__ == \"__main__\":\r\n name = \"John\"\r\n age = \"3\"\r\n SomeFunction(name, age=age, fake_arg=\"something\")\r\n```\r\n\r\nThe 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.\r\n\r\nThis is an issue with a multiple kwargs in the methods/functions is that a user can easily misspell and result in unexpected behavior.\r\n\r\n[PythonDemo.zip](https://github.com/pythonnet/pythonnet/files/15038606/PythonDemo.zip)\r\n","author":{"url":"https://github.com/dmitry-medvedev","@type":"Person","name":"dmitry-medvedev"},"datePublished":"2024-04-19T09:56:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/2360/pythonnet/issues/2360"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:33e79c9e-6726-cfc3-0a0f-402fc42722f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD1E:287443:3361267:456BDB2:69708D34 |
| html-safe-nonce | c619f5b3d72c7d75445e38545e8f6f51a44c5f76367fe8343fb21b696978b780 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDFFOjI4NzQ0MzozMzYxMjY3OjQ1NkJEQjI6Njk3MDhEMzQiLCJ2aXNpdG9yX2lkIjoiMTY0MjA0MTY3NjM1MzUzOTM4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 26e567c4b00e0972d23a91f50b639f73cbd60f04912d952f1cbea2e57dff363c |
| hovercard-subject-tag | issue:2252574704 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/2360/issue_layout |
| twitter:image | https://opengraph.githubassets.com/621d09ec88953351db73f8494f9756573bb452fa6d7e74fc9155998b99decea6/pythonnet/pythonnet/issues/2360 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/621d09ec88953351db73f8494f9756573bb452fa6d7e74fc9155998b99decea6/pythonnet/pythonnet/issues/2360 |
| og:image:alt | 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 does... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dmitry-medvedev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width