Skip to content

Commit a1316a1

Browse files
authored
Merge branch 'master' into python3.9
2 parents 094bf2c + 36bdb98 commit a1316a1

23 files changed

+250
-48
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ python:
99

1010
env:
1111
matrix:
12-
- BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp2.0_publish/ PERF_TESTS_PATH=net461/
12+
- BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp3.1_publish/ PERF_TESTS_PATH=net461/
1313
- BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" PERF_TESTS_PATH=""
14-
- PYTHONNET_SHUTDOWN_MODE="Soft" BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp2.0_publish/ PERF_TESTS_PATH=net461/
14+
- PYTHONNET_SHUTDOWN_MODE="Soft" BUILD_OPTS=--xplat NUNIT_PATH="~/.nuget/packages/nunit.consolerunner/3.*/tools/nunit3-console.exe" RUN_TESTS=dotnet EMBED_TESTS_PATH=netcoreapp3.1_publish/ PERF_TESTS_PATH=net461/
1515
- PYTHONNET_SHUTDOWN_MODE="Soft" BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" PERF_TESTS_PATH=""
1616

1717
global:
@@ -30,9 +30,7 @@ addons:
3030
packages:
3131
- mono-devel
3232
- ca-certificates-mono
33-
- dotnet-hostfxr-2.2
34-
- dotnet-runtime-2.2
35-
- dotnet-sdk-2.2
33+
- dotnet-sdk-3.1
3634

3735
before_install:
3836
# Set-up dll path for embedded tests

ci/appveyor_run_tests.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ if ($XPLAT){
9999
$DOTNET_CMD = "c:\Program Files (x86)\dotnet\dotnet"
100100
}
101101

102-
# Run Embedded tests for netcoreapp2.0 (OpenCover currently does not supports dotnet core)
103-
Write-Host ("Starting embedded tests for netcoreapp2.0") -ForegroundColor "Green"
104-
&$DOTNET_CMD ".\src\embed_tests\bin\netcoreapp2.0_publish\Python.EmbeddingTest.dll"
102+
# Run Embedded tests for netcoreapp3.1 (OpenCover currently does not supports dotnet core)
103+
Write-Host ("Starting embedded tests for netcoreapp3.1") -ForegroundColor "Green"
104+
&$DOTNET_CMD ".\src\embed_tests\bin\netcoreapp3.1_publish\Python.EmbeddingTest.dll"
105105
$CS_STATUS = $LastExitCode
106106
if ($CS_STATUS -ne 0) {
107-
Write-Host "Embedded tests for netcoreapp2.0 failed" -ForegroundColor "Red"
107+
Write-Host "Embedded tests for netcoreapp3.1 failed" -ForegroundColor "Red"
108108
ReportTime ""
109109
} else {
110110
ReportTime ".NET Core 2.0 tests completed"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def build_extension(self, ext):
351351
cmd
352352
+ [
353353
'"/t:Console_15:publish;Python_EmbeddingTest_15:publish"',
354-
"/p:TargetFramework=netcoreapp2.0",
354+
"/p:TargetFramework=netcoreapp3.1",
355355
]
356356
),
357357
shell=use_shell,

src/console/Console.15.csproj

Lines changed: 1 addition & 1 deletion
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;netcoreapp2.0</TargetFrameworks>
4+
<TargetFrameworks>net40;netcoreapp3.1</TargetFrameworks>
55
<Platforms>x64;x86</Platforms>
66
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
77
<OutputType>Exe</OutputType>

src/embed_tests/Python.EmbeddingTest.15.csproj

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

44
<PropertyGroup>
5-
<TargetFrameworks>net40;netcoreapp2.0</TargetFrameworks>
5+
<TargetFrameworks>net40;netcoreapp3.1</TargetFrameworks>
66
<Platforms>x64;x86</Platforms>
77
<Configurations>DebugMono;DebugMonoPY3;ReleaseMono;ReleaseMonoPY3;DebugWin;DebugWinPY3;ReleaseWin;ReleaseWinPY3</Configurations>
88
<OutputType Condition="'$(TargetFramework)' != 'net40' OR '$(PYTHONNET_VS_ENV)' == 'true'">Exe</OutputType>
@@ -28,7 +28,7 @@
2828
<CustomDefineConstants Condition="'$(CustomDefineConstants)' == ''">$(PYTHONNET_DEFINE_CONSTANTS)</CustomDefineConstants>
2929
<BaseDefineConstants>XPLAT</BaseDefineConstants>
3030
<DefineConstants>$(DefineConstants);$(CustomDefineConstants);$(BaseDefineConstants);</DefineConstants>
31-
<DefineConstants Condition="'$(TargetFramework)'=='netcoreapp2.0'">$(DefineConstants);NETCOREAPP</DefineConstants>
31+
<DefineConstants Condition="'$(TargetFramework)'=='netcoreapp3.1'">$(DefineConstants);NETCOREAPP</DefineConstants>
3232
<DefineConstants Condition="'$(TargetFramework)'=='netstandard2.0'">$(DefineConstants);NETSTANDARD</DefineConstants>
3333
<DefineConstants Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(CustomDefineConstants)' != '' AND $(Configuration.Contains('Debug'))">$(DefineConstants);TRACE;DEBUG</DefineConstants>
3434
<FrameworkPathOverride Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">$(NuGetPackageRoot)\microsoft.targetingpack.netframework.v4.5\1.0.1\lib\net45\</FrameworkPathOverride>
@@ -87,7 +87,7 @@
8787
</PackageReference>
8888
<PackageReference Include="NUnitLite" Version="3.12.0" />
8989
</ItemGroup>
90-
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
90+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
9191
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
9292
</ItemGroup>
9393
<ItemGroup>

src/embed_tests/TestDomainReload.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,13 @@ def test_obj_call():
203203
// Create a new module
204204
IntPtr module = PyRuntime.PyModule_New(name);
205205
Assert.That(module != IntPtr.Zero);
206-
IntPtr globals = PyRuntime.PyObject_GetAttrString(module, "__dict__");
206+
IntPtr globals = PyRuntime.PyObject_GetAttr(module, PyIdentifier.__dict__);
207207
Assert.That(globals != IntPtr.Zero);
208208
try
209209
{
210210
// import builtins
211211
// module.__dict__[__builtins__] = builtins
212-
int res = PyRuntime.PyDict_SetItemString(globals, "__builtins__",
212+
int res = PyRuntime.PyDict_SetItem(globals, PyIdentifier.__builtins__,
213213
PyRuntime.PyEval_GetBuiltins());
214214
PythonException.ThrowIfIsNotZero(res);
215215

src/runtime/Python.Runtime.15.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@
143143
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
144144
</ItemGroup>
145145

146+
<ItemGroup>
147+
<None Update="intern_.tt">
148+
<Generator>TextTemplatingFileGenerator</Generator>
149+
<LastGenOutput>intern_.cs</LastGenOutput>
150+
</None>
151+
</ItemGroup>
152+
153+
154+
<ItemGroup>
155+
<Compile Update="intern_.cs">
156+
<DesignTime>True</DesignTime>
157+
<AutoGen>True</AutoGen>
158+
<DependentUpon>intern_.tt</DependentUpon>
159+
</Compile>
160+
</ItemGroup>
161+
146162
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
147163

148164
<PropertyGroup>

src/runtime/Python.Runtime.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,16 @@
8282
<Compile Include="Codecs\TupleCodecs.cs" />
8383
<Compile Include="converterextensions.cs" />
8484
<Compile Include="finalizer.cs" />
85+
<Compile Include="intern.cs" />
86+
<Compile Include="intern_.cs" />
8587
<Compile Include="Properties\AssemblyInfo.cs" />
8688
<Compile Include="..\SharedAssemblyInfo.cs">
8789
<Link>Properties\SharedAssemblyInfo.cs</Link>
8890
</Compile>
8991
<Compile Include="arrayobject.cs" />
9092
<Compile Include="assemblymanager.cs" />
9193
<Compile Include="BorrowedReference.cs" />
92-
<Compile Include="bufferinterface.cs" />
94+
<Compile Include="bufferinterface.cs" />
9395
<Compile Include="classderived.cs" />
9496
<Compile Include="classbase.cs" />
9597
<Compile Include="classmanager.cs" />
@@ -131,7 +133,7 @@
131133
<Compile Include="overload.cs" />
132134
<Compile Include="propertyobject.cs" />
133135
<Compile Include="pyansistring.cs" />
134-
<Compile Include="pybuffer.cs" />
136+
<Compile Include="pybuffer.cs" />
135137
<Compile Include="pydict.cs" />
136138
<Compile Include="PyExportAttribute.cs" />
137139
<Compile Include="pyfloat.cs" />
@@ -186,4 +188,4 @@
186188
<Copy SourceFiles="$(TargetAssembly)" DestinationFolder="$(PythonBuildDir)" />
187189
<!--Copy SourceFiles="$(TargetAssemblyPdb)" Condition="Exists('$(TargetAssemblyPdb)')" DestinationFolder="$(PythonBuildDir)" /-->
188190
</Target>
189-
</Project>
191+
</Project>

src/runtime/classbase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public static IntPtr tp_repr(IntPtr ob)
279279
IntPtr args = Runtime.PyTuple_New(1);
280280
Runtime.XIncref(ob);
281281
Runtime.PyTuple_SetItem(args, 0, ob);
282-
IntPtr reprFunc = Runtime.PyObject_GetAttrString(Runtime.PyBaseObjectType, "__repr__");
282+
IntPtr reprFunc = Runtime.PyObject_GetAttr(Runtime.PyBaseObjectType, PyIdentifier.__repr__);
283283
var output = Runtime.PyObject_Call(reprFunc, args, IntPtr.Zero);
284284
Runtime.XDecref(args);
285285
Runtime.XDecref(reprFunc);

src/runtime/classmanager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ private static void InitClassBase(Type type, ClassBase impl)
232232
var attr = (DocStringAttribute)attrs[0];
233233
string docStr = attr.DocString;
234234
doc = Runtime.PyString_FromString(docStr);
235-
Runtime.PyDict_SetItemString(dict, "__doc__", doc);
235+
Runtime.PyDict_SetItem(dict, PyIdentifier.__doc__, doc);
236236
Runtime.XDecref(doc);
237237
}
238238

@@ -249,16 +249,16 @@ private static void InitClassBase(Type type, ClassBase impl)
249249
var ctors = new ConstructorBinding(type, tp, co.binder);
250250
// ExtensionType types are untracked, so don't Incref() them.
251251
// TODO: deprecate __overloads__ soon...
252-
Runtime.PyDict_SetItemString(dict, "__overloads__", ctors.pyHandle);
253-
Runtime.PyDict_SetItemString(dict, "Overloads", ctors.pyHandle);
252+
Runtime.PyDict_SetItem(dict, PyIdentifier.__overloads__, ctors.pyHandle);
253+
Runtime.PyDict_SetItem(dict, PyIdentifier.Overloads, ctors.pyHandle);
254254
ctors.DecrRefCount();
255255
}
256256

257257
// don't generate the docstring if one was already set from a DocStringAttribute.
258258
if (!CLRModule._SuppressDocs && doc == IntPtr.Zero)
259259
{
260260
doc = co.GetDocString();
261-
Runtime.PyDict_SetItemString(dict, "__doc__", doc);
261+
Runtime.PyDict_SetItem(dict, PyIdentifier.__doc__, doc);
262262
Runtime.XDecref(doc);
263263
}
264264
}

0 commit comments

Comments
 (0)