Skip to content

Commit f397ac4

Browse files
committed
merge with master
2 parents 98dff2c + 72fae73 commit f397ac4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2683
-450
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dotnet_sort_system_directives_first = true
2525
dotnet_separate_import_directive_groups = true
2626

2727
[*.cs]
28-
csharp_new_line_before_open_brace = true
28+
csharp_new_line_before_open_brace = all
2929
csharp_new_line_before_else = true
3030
csharp_new_line_before_catch = true
3131
csharp_new_line_before_finally = true

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ 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/
13-
- BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH=""
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/
13+
- BUILD_OPTS="" NUNIT_PATH="./packages/NUnit.*/tools/nunit3-console.exe" RUN_TESTS="mono $NUNIT_PATH" EMBED_TESTS_PATH="" PERF_TESTS_PATH=""
1414

1515
global:
1616
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
@@ -44,7 +44,9 @@ install:
4444

4545
script:
4646
- python -m pytest
47-
- $RUN_TESTS src/embed_tests/bin/$EMBED_TESTS_PATH/Python.EmbeddingTest.dll
47+
- $RUN_TESTS src/embed_tests/bin/$EMBED_TESTS_PATH/Python.EmbeddingTest.dll --labels=All
48+
# does not work on Linux, because NuGet package for 2.3 is Windows only
49+
# - "if [[ $TRAVIS_PYTHON_VERSION == '3.5' && $PERF_TESTS_PATH != '' ]]; then mono $NUNIT_PATH src/perf_tests/bin/$PERF_TESTS_PATH/Python.PerformanceTests.dll; fi"
4850

4951
after_script:
5052
# Waiting on mono-coverage, SharpCover or xr.Baboon

AUTHORS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
## Contributors
1414

15+
- Alex Earl ([@slide](https://github.com/slide))
1516
- Alex Helms ([@alexhelms](https://github.com/alexhelms))
1617
- Alexandre Catarino([@AlexCatarino](https://github.com/AlexCatarino))
18+
- Andrey Sant'Anna ([@andreydani](https://github.com/andreydani))
1719
- Arvid JB ([@ArvidJB](https://github.com/ArvidJB))
1820
- Benoît Hudson ([@benoithudson](https://github.com/benoithudson))
1921
- Bradley Friedman ([@leith-bartrich](https://github.com/leith-bartrich))
@@ -34,6 +36,7 @@
3436
- Ivan Cronyn ([@cronan](https://github.com/cronan))
3537
- Jan Krivanek ([@jakrivan](https://github.com/jakrivan))
3638
- Jeff Reback ([@jreback](https://github.com/jreback))
39+
- Jeff Robbins ([@jeff17robbins](https://github.com/jeff17robbins))
3740
- Joe Frayne ([@jfrayne](https://github.com/jfrayne))
3841
- Joe Lidbetter ([@jmlidbetter](https://github.com/jmlidbetter))
3942
- Joe Savage ([@s4v4g3](https://github.com/s4v4g3))
@@ -42,6 +45,7 @@
4245
- Luke Stratman ([@lstratman](https://github.com/lstratman))
4346
- Konstantin Posudevskiy ([@konstantin-posudevskiy](https://github.com/konstantin-posudevskiy))
4447
- Matthias Dittrich ([@matthid](https://github.com/matthid))
48+
- Meinrad Recheis ([@henon](https://github.com/henon))
4549
- Mohamed Koubaa ([@koubaa](https://github.com/koubaa))
4650
- Patrick Stewart ([@patstew](https://github.com/patstew))
4751
- Raphael Nestler ([@rnestler](https://github.com/rnestler))

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
1212
- Added automatic NuGet package generation in appveyor and local builds
1313
- Added function that sets Py_NoSiteFlag to 1.
1414
- Added support for Jetson Nano.
15+
- Added support for __len__ for .NET classes that implement ICollection
16+
- Added PythonException.Format method to format exceptions the same as traceback.format_exception
17+
- Added Runtime.None to be able to pass None as parameter into Python from .NET
18+
- Added PyObject.IsNone() to check if a Python object is None in .NET.
1519
- Added Python 3 buffer api support and PyBuffer interface for fast byte and numpy array read/write ([#980][p980])
1620

1721
### Changed
@@ -21,14 +25,18 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
2125
- Removes PyLong_GetMax and PyClass_New when targetting Python3
2226
- Added support for converting python iterators to C# arrays
2327
- Changed usage of obselete function GetDelegateForFunctionPointer(IntPtr, Type) to GetDelegateForFunctionPointer<TDelegate>(IntPtr)
28+
- 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])
2429
- Added support for kwarg parameters when calling .NET methods from Python
30+
- Changed method for finding MSBuild using vswhere
31+
- Reworked `Finalizer`. Now objects drop into its queue upon finalization, which is periodically drained when new objects are created.
2532

2633
### Fixed
2734

2835
- Fixed runtime that fails loading when using pythonnet in an environment
2936
together with Nuitka
3037
- Fixes bug where delegates get casts (dotnetcore)
3138
- Determine size of interpreter longs at runtime
39+
- Handling exceptions ocurred in ModuleObject's getattribute
3240

3341
## [2.4.0][]
3442

README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ projects using pythonnet can be found in the Wiki:
9595

9696
https://github.com/pythonnet/pythonnet/wiki
9797

98+
Python 3.8.0 support
99+
--------------------
100+
101+
Some features are disabled in Python 3.8.0 because of
102+
`this bug in Python <https://bugs.python.org/issue37633>`_. The error is
103+
``System.EntryPointNotFoundException : Unable to find an entry point named
104+
'Py_CompileString' in DLL 'python38'``. This will be fixed in Python 3.8.1.
105+
98106
.. |Join the chat at https://gitter.im/pythonnet/pythonnet| image:: https://badges.gitter.im/pythonnet/pythonnet.svg
99107
:target: https://gitter.im/pythonnet/pythonnet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
100108
.. |appveyor shield| image:: https://img.shields.io/appveyor/ci/pythonnet/pythonnet/master.svg?label=AppVeyor

ci/appveyor_build_recipe.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Build `conda.recipe` only if this is a Pull_Request. Saves time for CI.
22

3+
$stopwatch = [Diagnostics.Stopwatch]::StartNew()
4+
35
$env:CONDA_PY = "$env:PY_VER"
46
# Use pre-installed miniconda. Note that location differs if 64bit
57
$env:CONDA_BLD = "C:\miniconda36"
@@ -30,7 +32,9 @@ if ($env:APPVEYOR_PULL_REQUEST_NUMBER -or $env:APPVEYOR_REPO_TAG_NAME -or $env:F
3032

3133
$CONDA_PKG=(conda build conda.recipe --output)
3234
Copy-Item $CONDA_PKG .\dist\
33-
Write-Host "Completed conda build recipe" -ForegroundColor "Green"
35+
36+
$timeSpent = $stopwatch.Elapsed
37+
Write-Host "Completed conda build recipe in " $timeSpent -ForegroundColor "Green"
3438

3539
# Restore PATH back to original
3640
$env:path = $old_path

ci/appveyor_run_tests.ps1

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Script to simplify AppVeyor configuration and resolve path to tools
22

3+
$stopwatch = [Diagnostics.Stopwatch]::StartNew()
4+
[array]$timings = @()
5+
36
# Test Runner framework being used for embedded tests
47
$CS_RUNNER = "nunit3-console"
58

9+
$XPLAT = $env:BUILD_OPTS -eq "--xplat"
10+
611
# Needed for ARCH specific runners(NUnit2/XUnit3). Skip for NUnit3
712
if ($FALSE -and $env:PLATFORM -eq "x86"){
813
$CS_RUNNER = $CS_RUNNER + "-x86"
@@ -11,7 +16,7 @@ if ($FALSE -and $env:PLATFORM -eq "x86"){
1116
# Executable paths for OpenCover
1217
# Note if OpenCover fails, it won't affect the exit codes.
1318
$OPENCOVER = Resolve-Path .\packages\OpenCover.*\tools\OpenCover.Console.exe
14-
if ($env:BUILD_OPTS -eq "--xplat"){
19+
if ($XPLAT){
1520
$CS_RUNNER = Resolve-Path $env:USERPROFILE\.nuget\packages\nunit.consolerunner\*\tools\"$CS_RUNNER".exe
1621
}
1722
else{
@@ -23,6 +28,17 @@ $PY = Get-Command python
2328
$CS_TESTS = ".\src\embed_tests\bin\Python.EmbeddingTest.dll"
2429
$RUNTIME_DIR = ".\src\runtime\bin\"
2530

31+
function ReportTime {
32+
param([string] $action)
33+
34+
$timeSpent = $stopwatch.Elapsed
35+
$timings += [pscustomobject]@{action=$action; timeSpent=$timeSpent}
36+
Write-Host $action " in " $timeSpent -ForegroundColor "Green"
37+
$stopwatch.Restart()
38+
}
39+
40+
ReportTime "Preparation done"
41+
2642
# Run python tests with C# coverage
2743
Write-Host ("Starting Python tests") -ForegroundColor "Green"
2844
.$OPENCOVER -register:user -searchdirs:"$RUNTIME_DIR" -output:py.coverage `
@@ -31,20 +47,51 @@ Write-Host ("Starting Python tests") -ForegroundColor "Green"
3147
$PYTHON_STATUS = $LastExitCode
3248
if ($PYTHON_STATUS -ne 0) {
3349
Write-Host "Python tests failed, continuing to embedded tests" -ForegroundColor "Red"
50+
ReportTime ""
51+
} else {
52+
ReportTime "Python tests completed"
3453
}
3554

3655
# Run Embedded tests with C# coverage
3756
Write-Host ("Starting embedded tests") -ForegroundColor "Green"
3857
.$OPENCOVER -register:user -searchdirs:"$RUNTIME_DIR" -output:cs.coverage `
39-
-target:"$CS_RUNNER" -targetargs:"$CS_TESTS" `
58+
-target:"$CS_RUNNER" -targetargs:"$CS_TESTS --labels=All" `
4059
-filter:"+[*]Python.Runtime*" `
4160
-returntargetcode
4261
$CS_STATUS = $LastExitCode
4362
if ($CS_STATUS -ne 0) {
4463
Write-Host "Embedded tests failed" -ForegroundColor "Red"
64+
ReportTime ""
65+
} else {
66+
ReportTime "Embedded tests completed"
67+
68+
# NuGet for pythonnet-2.3 only has 64-bit binary for Python 3.5
69+
# the test is only built using modern stack
70+
if (($env:PLATFORM -eq "x64") -and ($XPLAT) -and ($env:PYTHON_VERSION -eq "3.5")) {
71+
# Run C# Performance tests
72+
Write-Host ("Starting performance tests") -ForegroundColor "Green"
73+
if ($XPLAT) {
74+
$CS_PERF_TESTS = ".\src\perf_tests\bin\net461\Python.PerformanceTests.dll"
75+
}
76+
else {
77+
$CS_PERF_TESTS = ".\src\perf_tests\bin\Python.PerformanceTests.dll"
78+
}
79+
&"$CS_RUNNER" "$CS_PERF_TESTS"
80+
$CS_PERF_STATUS = $LastExitCode
81+
if ($CS_PERF_STATUS -ne 0) {
82+
Write-Host "Performance tests (C#) failed" -ForegroundColor "Red"
83+
ReportTime ""
84+
} else {
85+
ReportTime "Performance tests (C#) completed"
86+
}
87+
} else {
88+
Write-Host ("Skipping performance tests for ", $env:PYTHON_VERSION) -ForegroundColor "Yellow"
89+
Write-Host ("on platform ", $env:PLATFORM, " xplat: ", $XPLAT) -ForegroundColor "Yellow"
90+
$CS_PERF_STATUS = 0
91+
}
4592
}
4693

47-
if ($env:BUILD_OPTS -eq "--xplat"){
94+
if ($XPLAT){
4895
if ($env:PLATFORM -eq "x64") {
4996
$DOTNET_CMD = "dotnet"
5097
}
@@ -54,15 +101,20 @@ if ($env:BUILD_OPTS -eq "--xplat"){
54101

55102
# Run Embedded tests for netcoreapp2.0 (OpenCover currently does not supports dotnet core)
56103
Write-Host ("Starting embedded tests for netcoreapp2.0") -ForegroundColor "Green"
57-
&$DOTNET_CMD .\src\embed_tests\bin\netcoreapp2.0_publish\Python.EmbeddingTest.dll
104+
&$DOTNET_CMD ".\src\embed_tests\bin\netcoreapp2.0_publish\Python.EmbeddingTest.dll"
58105
$CS_STATUS = $LastExitCode
59106
if ($CS_STATUS -ne 0) {
60107
Write-Host "Embedded tests for netcoreapp2.0 failed" -ForegroundColor "Red"
108+
ReportTime ""
109+
} else {
110+
ReportTime ".NET Core 2.0 tests completed"
61111
}
62112
}
63113

114+
Write-Host "Timings:" ($timings | Format-Table | Out-String) -ForegroundColor "Green"
115+
64116
# Set exit code to fail if either Python or Embedded tests failed
65-
if ($PYTHON_STATUS -ne 0 -or $CS_STATUS -ne 0) {
117+
if ($PYTHON_STATUS -ne 0 -or $CS_STATUS -ne 0 -or $CS_PERF_STATUS -ne 0) {
66118
Write-Host "Tests failed" -ForegroundColor "Red"
67119
$host.SetShouldExit(1)
68120
}

0 commit comments

Comments
 (0)