Skip to content

Commit e4e16a4

Browse files
authored
Revert "Enable C# parameters of type object accept any argument, passed from Python (pythonnet#853)" (pythonnet#882)
This reverts commit 43c972d.
1 parent 43c972d commit e4e16a4

File tree

4 files changed

+6
-63
lines changed

4 files changed

+6
-63
lines changed

CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
4141
- Reattach python exception traceback information (#545)
4242
- 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])
4343
- Refactored MethodBinder.Bind in preparation to make it extensible (#829)
44-
- 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])
4544
- Look for installed Windows 10 sdk's during installation instead of relying on specific versions.
4645

4746
### Fixed

src/embed_tests/Python.EmbeddingTest.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
<Compile Include="TestDomainReload.cs" />
9090
<Compile Include="TestExample.cs" />
9191
<Compile Include="TestFinalizer.cs" />
92-
<Compile Include="TestInstanceWrapping.cs" />
9392
<Compile Include="TestPyAnsiString.cs" />
9493
<Compile Include="TestPyFloat.cs" />
9594
<Compile Include="TestPyInt.cs" />

src/embed_tests/TestInstanceWrapping.cs

-58
This file was deleted.

src/runtime/converter.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,12 @@ internal static bool ToManagedValue(IntPtr value, Type obType,
382382
return ToArray(value, typeof(object[]), out result, setError);
383383
}
384384

385-
Runtime.XIncref(value); // PyObject() assumes ownership
386-
result = new PyObject(value);
387-
return true;
385+
if (setError)
386+
{
387+
Exceptions.SetError(Exceptions.TypeError, "value cannot be converted to Object");
388+
}
389+
390+
return false;
388391
}
389392

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

0 commit comments

Comments
 (0)