Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0abfde0
Full featured xplat build.
Jul 28, 2017
8b0b399
.Net 45 TargetingPack System.XML.dll naming fix. (For xplat linux bui…
Aug 18, 2017
3f02c12
Setup.py --xplat option refactored. Travis-ci build matrix extended.
Aug 18, 2017
78d5d46
AppVeyor matrix extended, xplat build added.
Aug 19, 2017
2dc1b47
appveyor.yml yaml syntax fix.
Aug 20, 2017
665b9d7
NUnit dependency upgraded to 3.7. Changelog improved.
Aug 20, 2017
504495e
EmbeddingTest fixes, and stubs.
Aug 22, 2017
1cc9008
Fix for importing numpy and other python modules with native parts.
Aug 22, 2017
2ac981b
Build order improvement.
Aug 22, 2017
2edbc87
NetCoreApp 2.0 fix. EmitCalli does not supports cdecl. Falling-back t…
Aug 27, 2017
dac5a96
Changelog improved.
Aug 22, 2017
0852392
All finalizers are disabled until valid implementation. Helps to avoi…
Sep 4, 2017
d16100c
NetCoreApp 2.0 target added, compile issues fixed, CI system improved.
Jul 29, 2017
ed48618
Mono builds now can be build on Windows.
Sep 6, 2017
3069fe4
Python.Runtime.dll now targets NetStandard2.0 inplace of NetCoreApp 2.0
Sep 6, 2017
0ca9612
Merge
Sep 6, 2017
afaca1b
Wrong NETSTANDARD/NETCOREAPP define constant change.
Sep 6, 2017
b20d134
Typo fix.
Sep 6, 2017
966f035
PYTHONNET_PY3_VERSION, PYTHONNET_PY2_VERSION build related environmen…
Sep 7, 2017
f4a6608
Small compile fixes.
Sep 7, 2017
a89685e
PYTHONNET_WIN_DEFINE_CONSTANTS and PYTHONNET_MONO_DEFINE_CONSTANTS in…
Sep 7, 2017
153de5e
.travis.yaml file simplification.
Sep 21, 2017
447da7d
PYTHONNET_INTEROP_FILE env var introduced to allow working with custo…
Sep 21, 2017
7293223
pdb generation improved for all conditions Net 4.0/NetStandard 2.0 x …
Sep 22, 2017
0df38c2
Fix for the #539 classic build fails when VS 2017 installed.
Sep 22, 2017
52a675f
Build fixes for the fresh Windows 10 SDKS.
Nov 4, 2017
64cb7f8
Workaround: Mono downgrade to 5.2.0 to avoid broken mono 5.4.0.201
Nov 7, 2017
2ba6bff
Merge #518
Nov 16, 2017
4aa8b18
Merge #519
Nov 16, 2017
c4910f0
vswhere.exe tool now distributed with the pythonnet sources, dotnet-c…
Sep 21, 2017
700b522
backout #546, wrong merge!
Nov 16, 2017
43a9eb6
Backed #519, wrong merge!
Nov 16, 2017
1c79426
backout #518, wrong merge !
Nov 16, 2017
194e5e6
Backing out wrong merges.
Nov 16, 2017
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
Prev Previous commit
Next Next commit
NetCoreApp 2.0 fix. EmitCalli does not supports cdecl. Falling-back t…
…o a slow Marshal-based solution. + x86 fix.
  • Loading branch information
dse committed Aug 27, 2017
commit 2edbc873e26682adf931c581a1a0fefa6df2b9d3
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ init:
install:
- pip install --upgrade -r requirements.txt --quiet
- choco install vswhere -y
# - cmd: curl -O https://download.microsoft.com/download/5/6/B/56BFEF92-9045-4414-970C-AB31E0FC07EC/dotnet-runtime-2.0.0-win-x86.exe
# - cmd: dotnet-runtime-2.0.0-win-x86.exe /install /quiet /norestart /log install.log
- cmd: curl -O https://download.microsoft.com/download/5/6/B/56BFEF92-9045-4414-970C-AB31E0FC07EC/dotnet-runtime-2.0.0-win-x86.exe
- cmd: dotnet-runtime-2.0.0-win-x86.exe /install /quiet /norestart /log install.log

# Install OpenCover. Can't put on `packages.config`, not Mono compatible
- .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet
Expand Down
3 changes: 0 additions & 3 deletions src/runtime/importhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ internal static void Shutdown()
if (Runtime.Py_IsInitialized() != 0)
{
Runtime.XDecref(py_clr_module);
// TODO: Very strange behavior under CoreCLR. System.ExecutionEngineException (Crash)
#if !NETCOREAPP
Runtime.XDecref(root.pyHandle);
#endif
Runtime.XDecref(py_import);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/metatype.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;

namespace Python.Runtime
Expand Down Expand Up @@ -201,7 +201,7 @@ public static int tp_setattro(IntPtr tp, IntPtr name, IntPtr value)
IntPtr fp = Marshal.ReadIntPtr(dt, TypeOffset.tp_descr_set);
if (fp != IntPtr.Zero)
{
return NativeCall.Impl.Int_Call_3(fp, descr, name, value);
return NativeCall.Int_Call_3(fp, descr, name, value);
}
Exceptions.SetError(Exceptions.AttributeError, "attribute is read-only");
return -1;
Expand Down
39 changes: 30 additions & 9 deletions src/runtime/nativecall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,32 @@ namespace Python.Runtime
/// </summary>
internal class NativeCall
{
#if NETCOREAPP
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void Void_1_Delegate(IntPtr a1);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr IntPtr_3_Delegate(IntPtr a1, IntPtr a2, IntPtr a3);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate int Int_3_Delegate(IntPtr a1, IntPtr a2, IntPtr a3);

public static void Void_Call_1(IntPtr fp, IntPtr a1)
{
((Void_1_Delegate)Marshal.GetDelegateForFunctionPointer(fp, typeof(Void_1_Delegate)))(a1);
}

public static IntPtr Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3)
{
return ((IntPtr_3_Delegate)Marshal.GetDelegateForFunctionPointer(fp, typeof(IntPtr_3_Delegate)))(a1, a2, a3);
}


public static int Int_Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3)
{
return ((Int_3_Delegate)Marshal.GetDelegateForFunctionPointer(fp, typeof(Int_3_Delegate)))(a1, a2, a3);
}
#else
private static AssemblyBuilder aBuilder;
private static ModuleBuilder mBuilder;

Expand Down Expand Up @@ -106,19 +132,12 @@ private static void GenerateThunk(TypeBuilder tb, MethodInfo method)

il.Emit(OpCodes.Ldarg_1);

#if NETCOREAPP
il.EmitCalli(OpCodes.Calli,
CallingConventions.ExplicitThis,
method.ReturnType,
nargs, null
);
#else
il.EmitCalli(OpCodes.Calli,
CallingConvention.Cdecl,
method.ReturnType,
nargs
);
#endif

il.Emit(OpCodes.Ret);

tb.DefineMethodOverride(mb, method);
Expand All @@ -139,9 +158,10 @@ public static int Int_Call_3(IntPtr fp, IntPtr a1, IntPtr a2, IntPtr a3)
{
return Impl.Int_Call_3(fp, a1, a2, a3);
}
#endif
}


#if !NETCORAPP
/// <summary>
/// Defines native call signatures to be generated by NativeCall.
/// </summary>
Expand All @@ -155,4 +175,5 @@ public interface INativeCall

IntPtr Call_3(IntPtr funcPtr, IntPtr a1, IntPtr a2, IntPtr a3);
}
#endif
}
4 changes: 2 additions & 2 deletions src/runtime/runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ internal static Type[] PythonArgsToTypeArray(IntPtr arg, bool mangleObjects)
/// </summary>
internal static unsafe void XIncref(IntPtr op)
{
#if PYTHON_WITH_PYDEBUG
#if PYTHON_WITH_PYDEBUG || NETCOREAPP
Py_IncRef(op);
return;
#else
Expand All @@ -543,7 +543,7 @@ internal static unsafe void XIncref(IntPtr op)

internal static unsafe void XDecref(IntPtr op)
{
#if PYTHON_WITH_PYDEBUG
#if PYTHON_WITH_PYDEBUG || NETCOREAPP
Py_DecRef(op);
return;
#else
Expand Down