Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Revert "Enable C# parameters of type object accept any argument, passed from Python" #882

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

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
- Reattach python exception traceback information (#545)
- PythonEngine.Intialize will now call `Py_InitializeEx` with a default value of 0, so signals will not be configured by default on embedding. This is different from the previous behaviour, where `Py_Initialize` was called instead, which sets initSigs to 1. ([#449][i449])
- Refactored MethodBinder.Bind in preparation to make it extensible (#829)
- When calling C# from Python, enable passing argument of any type to a parameter of C# type `object` by wrapping it into `PyObject` instance. ([#881][i881])
- Look for installed Windows 10 sdk's during installation instead of relying on specific versions.

### Fixed
Expand Down
1 change: 0 additions & 1 deletion src/embed_tests/Python.EmbeddingTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
<Compile Include="TestDomainReload.cs" />
<Compile Include="TestExample.cs" />
<Compile Include="TestFinalizer.cs" />
<Compile Include="TestInstanceWrapping.cs" />
<Compile Include="TestPyAnsiString.cs" />
<Compile Include="TestPyFloat.cs" />
<Compile Include="TestPyInt.cs" />
Expand Down
58 changes: 0 additions & 58 deletions src/embed_tests/TestInstanceWrapping.cs

This file was deleted.

9 changes: 6 additions & 3 deletions src/runtime/converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,12 @@ internal static bool ToManagedValue(IntPtr value, Type obType,
return ToArray(value, typeof(object[]), out result, setError);
}

Runtime.XIncref(value); // PyObject() assumes ownership
result = new PyObject(value);
return true;
if (setError)
{
Exceptions.SetError(Exceptions.TypeError, "value cannot be converted to Object");
}

return false;
}

// Conversion to 'Type' is done using the same mappings as above for objects.
Expand Down