8000 Merge #519 · pythonnet/pythonnet@4aa8b18 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4aa8b18

Browse files
author
dse
committed
Merge #519
2 parents 2ba6bff + b20d134 commit 4aa8b18

24 files changed

+214
-46
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ install:
169169
script:
170170
- python -m pytest
171171
- mono $NUNIT_PATH src/embed_tests/bin/Python.EmbeddingTest.dll
172+
- if [[ $BUILD_OPTS == --xplat ]]; then dotnet src/embed_tests/bin/netcoreapp2.0_publish/Python.EmbeddingTest.dll; fi
172173

173174
after_script:
174175
# Uncomment if need to geninterop, ie. py37 final

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
88
## [unreleased][]
99

1010
### Added
11+
- Added support for embedding python into dotnet core 2.0 (NetStandard 2.0)
1112
- Added new build system (pythonnet.15.sln) based on dotnetcore-sdk/xplat(crossplatform msbuild).
1213
Currently there two side-by-side build systems that produces the same output (net40) from the same sources.
1314
After a some transition time, current (mono/ msbuild 14.0) build system will be removed.

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ init:
4343
install:
4444
- pip install --upgrade -r requirements.txt --quiet
4545
- choco install vswhere -y
46+
- cmd: curl -O https://download.microsoft.com/download/5/6/B/56BFEF92-9045-4414-970C-AB31E0FC07EC/dotnet-runtime-2.0.0-win-x86.exe
47+
- cmd: dotnet-runtime-2.0.0-win-x86.exe /install /quiet /norestart /log install.log
4648

4749
# Install OpenCover. Can't put on `packages.config`, not Mono compatible
4850
- .\tools\nuget\nuget.exe install OpenCover -OutputDirectory packages -Verbosity quiet

ci/appveyor_run_tests.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ if ($CS_STATUS -ne 0) {
4444
Write-Host "Embedded tests failed" -ForegroundColor "Red"
4545
}
4646

47+
if ($env:BUILD_OPTS -eq "--xplat"){
48+
if ($env:PLATFORM -eq "x64") {
49+
$DOTNET_CMD = "dotnet"
50+
}
51+
else{
52+
$DOTNET_CMD = "c:\Program Files (x86)\dotnet\dotnet"
53+
}
54+
55+
# Run Embedded tests for netcoreapp2.0 (OpenCover currently does not supports dotnet core)
56+
Write-Host ("Starting embedded tests for netcoreapp2.0") -ForegroundColor "Green"
57+
&$DOTNET_CMD .\src\embed_tests\bin\netcoreapp2.0_publish\Python.EmbeddingTest.dll
58+
$CS_STATUS = $LastExitCode
59+
if ($CS_STATUS -ne 0) {
60+
Write-Host "Embedded tests for netcoreapp2.0 failed" -ForegroundColor "Red"
61+
}
62+
}
63+
4764
# Set exit code to fail if either Python or Embedded tests failed
4865
if ($PYTHON_STATUS -ne 0 -or $CS_STATUS -ne 0) {
4966
Write-Host "Tests failed" -ForegroundColor "Red"

pythonnet.15.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
33
VisualStudioVersion = 15.0.26730.3
44
MinimumVisualStudioVersion = 10.0.40219.1
5-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime.15", "src\runtime\Python.Runtime.15.csproj", "{2759F4FF-716B-4828-916F-50FA86613DFC}"
5+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime.15", "src/runtime/Python.Runtime.15.csproj", "{2759F4FF-716B-4828-916F-50FA86613DFC}"
66
EndProject
7-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "src\embed_tests\Python.EmbeddingTest.15.csproj", "{66B8D01A-9906-452A-B09E-BF75EA76468F}"
7+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "src/embed_tests/Python.EmbeddingTest.15.csproj", "{66B8D01A-9906-452A-B09E-BF75EA76468F}"
88
EndProject
9-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "clrmodule.15", "src\clrmodule\clrmodule.15.csproj", "{E08678D4-9A52-4AD5-B63D-8EBC7399981B}"
9+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "clrmodule.15", "src/clrmodule/clrmodule.15.csproj", "{E08678D4-9A52-4AD5-B63D-8EBC7399981B}"
1010
EndProject
11-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console.15", "src\console\Console.15.csproj", "{CDAD305F-8E72-492C-A314-64CF58D472A0}"
11+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Console.15", "src/console/Console.15.csproj", "{CDAD305F-8E72-492C-A314-64CF58D472A0}"
1212
EndProject
13-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test.15", "src\testing\Python.Test.15.csproj", "{F94B547A-E97E-4500-8D53-B4D64D076E5F}"
13+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Test.15", "src/testing/Python.Test.15.csproj", "{F94B547A-E97E-4500-8D53-B4D64D076E5F}"
1414
EndProject
1515
Global
1616
GlobalSection(SolutionConfigurationPlatforms) = preSolution

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ def build_extension(self, ext):
257257

258258
subprocess.check_call(" ".join(cmd + ["/t:Clean"]), shell=use_shell)
259259
subprocess.check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell)
260-
260+
if DEVTOOLS == "MsDev15" or DEVTOOLS == "dotnet":
261+
subprocess.check_call(" ".join(cmd + ['"/t:Console_15:publish;Python_EmbeddingTest_15:publish"', "/p:TargetFramework=netcoreapp2.0"]), shell=use_shell)
261262
if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet":
262263
self._build_monoclr()
263264

src/clrmodule/clrmodule.15.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<NoWarn>1591</NoWarn>
2323
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
2424
<PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir>
25+
<PythonBuildDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PythonBuildDir>
2526
<LangVersion>6</LangVersion>
2627
<ErrorReport>prompt</ErrorReport>
2728
<CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants>

src/console/Console.15.csproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
33
<PropertyGroup>
4-
<TargetFrameworks>net40</TargetFrameworks>
4+
<TargetFrameworks>net40;netcoreapp2.0</TargetFrameworks>
55
<Platforms>x64;x86</Platforms>
66
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
77
<OutputType>Exe</OutputType>
@@ -15,12 +15,14 @@
1515
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1616
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
1717
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
18-
<DocumentationFile>bin\nPython.xml</DocumentationFile>
1918
<OutputPath>bin\</OutputPath>
20-
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
19+
<AppendTargetFrameworkToOutputPath Condition="'$(TargetFramework)'=='net40'">false</AppendTargetFrameworkToOutputPath>
20+
<DocumentationFile Condition="'$(TargetFramework)'=='net40'">$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
21+
<DocumentationFile Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
2122
<NoWarn>1591</NoWarn>
2223
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
2324
<PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir>
25+
<PublishDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PublishDir>
2426
<LangVersion>6</LangVersion>
2527
<ApplicationIcon>python-clear.ico</ApplicationIcon>
2628
<ErrorReport>prompt</ErrorReport>
@@ -89,7 +91,7 @@
8991
</ItemGroup>
9092
<ItemGroup>
9193
<Content Include="python-clear.ico" />
92-
<EmbeddedResource Include="$(PythonBuildDir)\Python.Runtime.dll">
94+
<EmbeddedResource Condition="'$(TargetFramework)'=='net40'" Include="$(PythonBuildDir)\Python.Runtime.dll">
9395
<LogicalName>Python.Runtime.dll</LogicalName>
9496
</EmbeddedResource>
9597
</ItemGroup>
@@ -100,6 +102,6 @@
100102
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
101103

102104
<Target Name="AfterBuild">
103-
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PythonBuildDir)" />
105+
<Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetPath)" DestinationFolder="$(PythonBuildDir)" />
104106
</Target>
105107
</Project>

src/console/pythonconsole.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@ namespace Python.Runtime
1616
/// </remarks>
1717
public sealed class PythonConsole
1818
{
19+
#if NET40
1920
private static AssemblyLoader assemblyLoader = new AssemblyLoader();
20-
21+
#endif
2122
private PythonConsole()
2223
{
2324
}
2425

2526
[STAThread]
2627
public static int Main(string[] args)
2728
{
29+
// Only net40 is capable to safely inject python.runtime.dll into resources.
30+
#if NET40
2831
// reference the static assemblyLoader to stop it being optimized away
2932
AssemblyLoader a = assemblyLoader;
30-
33+
#endif
3134
string[] cmd = Environment.GetCommandLineArgs();
3235
PythonEngine.Initialize();
3336

@@ -37,6 +40,7 @@ public static int Main(string[] args)
3740
return i;
3841
}
3942

43+
#if NET40
4044
// Register a callback function to load embedded assemblies.
4145
// (Python.Runtime.dll is included as a resource)
4246
private sealed class AssemblyLoader
@@ -73,5 +77,6 @@ public AssemblyLoader()
7377
};
7478
}
7579
}
80+
#endif
7681
}
7782
}

src/embed_tests/Program.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
using NUnit.Common;
4+
5+
using NUnitLite;
6+
7+
namespace Python.EmbeddingTest
8+
{
9+
public class Program
10+
{
11+
public static int Main(string[] args)
12+
{
13+
return new AutoRun(typeof(Program).Assembly).Execute(
14+
args,
15+
new ExtendedTextWrapper(Console.Out),
16+
Console.In);
17+
}
18+
}
19+
}

src/embed_tests/Python.EmbeddingTest.15.csproj

Lines changed: 15 additions & 7 deletions
116
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>net40</TargetFrameworks>
5+
<TargetFrameworks>net40;netcoreapp2.0</TargetFrameworks>
66
<Platforms>x64;x86</Platforms>
77
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
8-
<AssetTargetFallback Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">net45</AssetTargetFallback>
8+
<OutputType Condition="'$(TargetFramework)' != 'net40' OR '$(PYTHONNET_VS_ENV)' == 'true'">Exe</OutputType>
9+
<GenerateProgramFile>false</GenerateProgramFile>
910
<AssemblyName>Python.EmbeddingTest</AssemblyName>
1011
<RootNamespace>Python.EmbeddingTest</RootNamespace>
1112
<PackageId>Python.EmbeddingTest</PackageId>
@@ -15,16 +16,19 @@
1516
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
1617
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1718
<OutputPath>bin\</OutputPath>
18-
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
19-
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
19+
<AppendTargetFrameworkToOutputPath Condition="'$(TargetFramework)'=='net40'">false</AppendTargetFrameworkToOutputPath>
20+
<DocumentationFile Condition="'$(TargetFramework)'=='net40'">$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
21+
<DocumentationFile Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
2022
<NoWarn>1591</NoWarn>
2123
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
22-
<PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir>
24+
<PythonBuildDir Condition="'$(TargetFramework)'=='net40' AND '$(PythonBuildDir)' == ''">$(SolutionDir)\bin\</PythonBuildDir>
25+
<PublishDir Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)_publish</PublishDir>
2326
<LangVersion>6</LangVersion>
2427
<ErrorReport>prompt</ErrorReport>
2528
<CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants>
2629
<BaseDefineConstants>XPLAT</BaseDefineConstants>
2730
<DefineConstants>$(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants);</DefineConstants>
31+
<DefineConstants Condition="'$(TargetFramework)'=='netcoreapp2.0'">$(DefineConstants);NETCOREAPP</DefineConstants>
2832
<DefineConstants Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(CustomDefineConstants)' != '' AND $(Configuration.Contains('Debug'))">$(DefineConstants);TRACE;DEBUG</DefineConstants>
2933
<FrameworkPathOverride Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\</FrameworkPathOverride>
3034
</PropertyGroup>
@@ -88,8 +92,12 @@
8892
<ItemGroup>
8993
<PackageReference Include="NUnit" Version="3.7.1" />
9094
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
95+
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
96+
<PackageReference Include="NUnitLite" Version="3.7.2" />
97+
</ItemGroup>
98+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
99+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
91100
</ItemGroup>
92-
93101
<ItemGroup>
94102
<ProjectReference Include="..\runtime\Python.Runtime.15.csproj" />
95103
</ItemGroup>
@@ -114,7 +122,7 @@
114122
</PropertyGroup>
115123

124
<Target Name="AfterBuild">
117-
<Copy SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
125+
<Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
118126
<!--Copy SourceFiles="$(TargetAssemblyPdb)" Condition="Exists('$(TargetAssemblyPdb)')" DestinationFolder="$(PythonBuildDir)" /-->
119127
</Target>
120128

src/embed_tests/TestPySequence.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ public void TestRepeat()
6969
PyObject actual = t1.Repeat(3);
7070
Assert.AreEqual("FooFooFoo", actual.ToString());
7171

72-
actual = t1.Repeat(-3);
73-
Assert.AreEqual("", actual.ToString());
72+
// On 32 bit system this argument should be int, but on the 64 bit system this should be long value.
73+
// This works on the Framework 4.0 accidentally, it should produce out of memory!
74+
// actual = t1.Repeat(-3);
75+
// Assert.AreEqual("", actual.ToString());
7476
}
7577

7678
[Test]

src/embed_tests/pyimport.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ public void SetUp()
3030
/* Append the tests directory to sys.path
3131
* using reflection to circumvent the private
3232
* modifiers placed on most Runtime methods. */
33+
#if NETCOREAPP
34+
const string s = "../../fixtures";
35+
#else
3336
const string s = "../fixtures";
37+
#endif
3438
string testPath = Path.Combine(TestContext.CurrentContext.TestDirectory, s);
3539

3640
IntPtr str = Runtime.Runtime.PyString_FromString(testPath);

src/runtime/Python.Runtime.15.csproj

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
33
<PropertyGroup>
4-
<TargetFrameworks>net40</TargetFrameworks>
4+
<TargetFrameworks>net40;netstandard2.0</TargetFrameworks>
55
<Platforms>AnyCPU</Platforms>
66
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
77
<AssetTargetFallback Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">net45</AssetTargetFallback>
@@ -16,17 +16,20 @@
1616
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
1717
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
1818
<OutputPath>bin\</OutputPath>
19-
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
20-
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
19+
<AppendTargetFrameworkToOutputPath Condition="'$(TargetFramework)'=='net40'">false</AppendTargetFrameworkToOutputPath>
20+
<DocumentationFile Condition="'$(TargetFramework)'=='net40'">$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
21+
<DocumentationFile Condition="'$(TargetFramework)'!='net40'">$(OutputPath)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
2122
<NoWarn>1591;NU1701</NoWarn>
2223
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
23-
<PythonBuildDir Condition=" '$(PythonBuildDir)' == '' ">$(SolutionDir)\bin\</PythonBuildDir>
24+
<PythonBuildDir Condition="'$(PythonBuildDir)' == ''">$(SolutionDir)\bin\</PythonBuildDir>
25+
<PublishDir Condition="'$(TargetFramework)'!='net40'">$(PythonBuildDir)\$(TargetFramework)\</PublishDir>
2426
<LangVersion>6</LangVersion>
2527
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
2628
<AssemblyOriginatorKeyFile>..\pythonnet.snk</AssemblyOriginatorKeyFile>
2729
<CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants>
2830
<BaseDefineConstants>XPLAT</BaseDefineConstants>
2931
<DefineConstants>$(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants);</DefineConstants>
32+
<DefineConstants Condition="'$(TargetFramework)'=='netstandard2.0'">$(DefineConstants);NETSTANDARD</DefineConstants>
3033
<DefineConstants Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(CustomDefineConstants)' != '' AND $(Configuration.Contains('Debug'))">$(DefineConstants);TRACE;DEBUG</DefineConstants>
3134
<FrameworkPathOverride Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\</FrameworkPathOverride>
3235
<Python2Version>$(PYTHONNET_PY2_VERSION)</Python2Version>
@@ -107,6 +110,11 @@
107110
</EmbeddedResource>
108111
</ItemGroup>
109112

113+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
114+
<PackageReference Include="System.Security.Permissions" Version="4.4.0" />
115+
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
116+
</ItemGroup>
117+
110118
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
111119
<Reference Include="Microsoft.CSharp" />
112120< F438 /code>
</ItemGroup>
@@ -127,7 +135,7 @@
127135
<Exec Command="cp $(NuGetPackageRoot)/microsoft.targetingpack.netframework.v4.5/1.0.1/lib/net45/System.XML.dll $(NuGetPackageRoot)/microsoft.targetingpack.netframework.v4.5/1.0.1/lib/net45/System.Xml.dll" />
128136
</Target>
129137
<Target Name="AfterBuild">
130-
<Copy SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
138+
<Copy Condition="'$(TargetFramework)'=='net40'" SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
131139
<!--Copy SourceFiles="$(TargetAssemblyPdb)" Condition="Exists('$(TargetAssemblyPdb)')" DestinationFolder="$(PythonBuildDir)" /-->
132140
</Target>
133141
</Project>

src/runtime/delegatemanager.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ public Dispatcher(IntPtr target, Type dtype)
195195

196196
~Dispatcher()
197197
{
198+
// We needs to disable Finalizers until it's valid implementation.
199+
// Current implementation can produce low probability floating bugs.
200+
return;
201+
198202
// Note: the managed GC thread can run and try to free one of
199203
// these *after* the Python runtime has been finalized!
200204
if (Runtime.Py_IsInitialized() > 0)

src/runtime/metatype.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Runtime.InteropServices;
33

44
namespace Python.Runtime
@@ -201,7 +201,7 @@ public static int tp_setattro(IntPtr tp, IntPtr name, IntPtr value)
201201
IntPtr fp = Marshal.ReadIntPtr(dt, TypeOffset.tp_descr_set);
202202
if (fp != IntPtr.Zero)
203203
{
204-
return NativeCall.Impl.Int_Call_3(fp, descr, name, value);
204+
return NativeCall.Int_Call_3(fp, descr, name, value);
205205
}
206206
Exceptions.SetError(Exceptions.AttributeError, "attribute is read-only");
207207
return -1;

0 commit comments

Comments
 (0)
0