From cc194443384e0dcffc58bdcdf8b1535a3fc89da1 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 4 Feb 2021 09:12:58 +0100 Subject: [PATCH 1/2] ParameterInfo.Name needs to be checked for null before usage This occured in trying to use F# code from Python. As the `.Name` property returns `null`, `ContainsKey` fails. Related documentation: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.parameterinfo.name --- src/runtime/methodbinder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/methodbinder.cs b/src/runtime/methodbinder.cs index 034c1c3e8..8f74e0052 100644 --- a/src/runtime/methodbinder.cs +++ b/src/runtime/methodbinder.cs @@ -622,7 +622,7 @@ static object[] TryConvertArguments(ParameterInfo[] pi, bool paramsArray, for (int paramIndex = 0; paramIndex < pi.Length; paramIndex++) { var parameter = pi[paramIndex]; - bool hasNamedParam = kwargDict.ContainsKey(parameter.Name); + bool hasNamedParam = parameter.Name != null ? kwargDict.ContainsKey(parameter.Name) : false; bool isNewReference = false; if (paramIndex >= pyArgCount && !(hasNamedParam || (paramsArray && paramIndex == arrayStart))) From cd39c35d25db7e5a9f84cdc009f08ac647385bba Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 4 Feb 2021 09:25:37 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f2e544df..d30dfa059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ or the DLL must be loaded in advance. This must be done before calling any other - `import` may now raise errors with more detail than "No module named X" - Exception stacktraces on `PythonException.StackTrace` are now properly formatted - Providing an invalid type parameter to a generic type or method produces a helpful Python error +- Empty parameter names (as can be generated from F#) do not cause crashes ### Removed pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy