Skip to content

Commit 502f0c3

Browse files
authored
Merge branch 'master' into repr
2 parents 82aea1f + 2bc514f commit 502f0c3

16 files changed

+91
-133
lines changed

AUTHORS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
- David Lechner ([@dlech](https://github.com/dlech))
2828
- Dmitriy Se ([@dmitriyse](https://github.com/dmitriyse))
2929
- He-chien Tsai ([@t3476](https://github.com/t3476))
30-
-   Ivan Cronyn ([@cronan](https://github.com/cronan))
30+
- Inna Wiesel ([@inna-w](https://github.com/inna-w))
31+
- Ivan Cronyn ([@cronan](https://github.com/cronan))
3132
- Jan Krivanek ([@jakrivan](https://github.com/jakrivan))
32-
-   Jeff Reback ([@jreback](https://github.com/jreback))
33+
- Jeff Reback ([@jreback](https://github.com/jreback))
3334
- Joe Frayne ([@jfrayne](https://github.com/jfrayne))
3435
- John Burnett ([@johnburnett](https://github.com/johnburnett))
3536
- John Wilkes ([@jbw3](https://github.com/jbw3))

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
99

1010
### Added
1111

12+
- Added automatic NuGet package generation in appveyor and local builds
13+
14+
### Changed
15+
16+
### Fixed
17+
18+
## [2.4.0][]
19+
20+
### Added
21+
1222
- Added support for embedding python into dotnet core 2.0 (NetStandard 2.0)
1323
- Added new build system (pythonnet.15.sln) based on dotnetcore-sdk/xplat(crossplatform msbuild).
1424
Currently there two side-by-side build systems that produces the same output (net40) from the same sources.

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pythonnet - Python for .NET
55

66
|appveyor shield| |travis shield| |codecov shield|
77

8-
|license shield| |pypi package version| |python supported shield|
8+
|license shield| |pypi package version| |conda-forge version| |python supported shield|
99
|stackexchange shield|
1010

1111
Python for .NET is a package that gives Python programmers nearly
@@ -48,7 +48,7 @@ Embedding Python in .NET
4848
- All python objects should be declared as ``dynamic`` type.
4949
- Mathematical operations involving python and literal/managed types
5050
must have the python object first, eg. ``np.pi * 2`` works,
51-
``2 * np.pi`` doesnt.
51+
``2 * np.pi`` doesn't.
5252

5353
Example
5454
~~~~~~~
@@ -111,3 +111,5 @@ https://github.com/pythonnet/pythonnet/wiki
111111
:target: https://pypi.python.org/pypi/pythonnet
112112
.. |stackexchange shield| image:: https://img.shields.io/badge/StackOverflow-python.net-blue.svg
113113
:target: http://stackoverflow.com/questions/tagged/python.net
114+
.. |conda-forge version| image:: https://img.shields.io/conda/vn/conda-forge/pythonnet.svg
115+
:target: https://anaconda.org/conda-forge/pythonnet

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ on_finish:
7272

7373
artifacts:
7474
- path: dist\*
75+
- path: '.\src\runtime\bin\*.nupkg'
7576

7677
notifications:
7778
- provider: Slack

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ def build_extension(self, ext):
334334
),
335335
'/p:PythonBuildDir="{}"'.format(os.path.abspath(dest_dir)),
336336
'/p:PythonInteropFile="{}"'.format(os.path.basename(interop_file)),
337+
"/p:PackageId=pythonnet_py{0}{1}_{2}".format(PY_MAJOR, PY_MINOR, ARCH),
337338
"/verbosity:{}".format(VERBOSITY),
338339
]
339340

@@ -622,7 +623,7 @@ def run(self):
622623

623624
setup(
624625
name="pythonnet",
625-
version="2.4.0-rc2",
626+
version="2.4.1-dev",
626627
description=".Net and Mono integration for Python",
627628
url="https://pythonnet.github.io/",
628629
license="MIT",
@@ -647,7 +648,6 @@ def run(self):
647648
"Programming Language :: Python :: 2",
648649
"Programming Language :: Python :: 2.7",
649650
"Programming Language :: Python :: 3",
650-
"Programming Language :: Python :: 3.4",
651651
"Programming Language :: Python :: 3.5",
652652
"Programming Language :: Python :: 3.6",
653653
"Programming Language :: Python :: 3.7",

src/SharedAssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
// Version Information. Keeping it simple. May need to revisit for Nuget
2626
// See: https://codingforsmarties.wordpress.com/2016/01/21/how-to-version-assemblies-destined-for-nuget/
2727
// AssemblyVersion can only be numeric
28-
[assembly: AssemblyVersion("2.4.0")]
28+
[assembly: AssemblyVersion("2.4.1")]

src/clrmodule/ClrModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static void initclr()
5353
{
5454
#if USE_PYTHON_RUNTIME_VERSION
5555
// Has no effect until SNK works. Keep updated anyways.
56-
Version = new Version("2.4.0"),
56+
Version = new Version("2.4.1"),
5757
#endif
5858
CultureInfo = CultureInfo.InvariantCulture
5959
};

src/clrmodule/clrmodule.15.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<RootNamespace>clrmodule</RootNamespace>
1010
<AssemblyName>clrmodule</AssemblyName>
1111
<PackageId>clrmodule</PackageId>
12-
<VersionPrefix>2.4.0</VersionPrefix>
12+
<VersionPrefix>2.4.1</VersionPrefix>
1313
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
1414
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
1515
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>

src/console/Console.15.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AssemblyName>nPython</AssemblyName>
99
<RootNamespace>Python.Runtime</RootNamespace>
1010
<PackageId>nPython</PackageId>
11-
<VersionPrefix>2.4.0</VersionPrefix>
11+
<VersionPrefix>2.4.1</VersionPrefix>
1212
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
1313
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
1414
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>

src/embed_tests/Python.EmbeddingTest.15.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<AssemblyName>Python.EmbeddingTest</AssemblyName>
1111
<RootNamespace>Python.EmbeddingTest</RootNamespace>
1212
<PackageId>Python.EmbeddingTest</PackageId>
13-
<VersionPrefix>2.4.0</VersionPrefix>
13+
<VersionPrefix>2.4.1</VersionPrefix>
1414
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
1515
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
1616
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>

src/embed_tests/TestFinalizer.cs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,43 +36,55 @@ public void CollectBasicObject()
3636
{
3737
Assert.IsTrue(Finalizer.Instance.Enable);
3838

39-
int thId = Thread.CurrentThread.ManagedThreadId;
4039
Finalizer.Instance.Threshold = 1;
4140
bool called = false;
41+
var objectCount = 0;
4242
EventHandler<Finalizer.CollectArgs> handler = (s, e) =>
4343
{
44-
Assert.AreEqual(thId, Thread.CurrentThread.ManagedThreadId);
45-
Assert.GreaterOrEqual(e.ObjectCount, 1);
44+
objectCount = e.ObjectCount;
4645
called = true;
4746
};
4847

48+
Assert.IsFalse(called, "The event handler was called before it was installed");
49+
Finalizer.Instance.CollectOnce += handler;
50+
4951
WeakReference shortWeak;
5052
WeakReference longWeak;
5153
{
5254
MakeAGarbage(out shortWeak, out longWeak);
5355
}
5456
FullGCCollect();
5557
// The object has been resurrected
56-
Assert.IsFalse(shortWeak.IsAlive);
57-
Assert.IsTrue(longWeak.IsAlive);
58+
Warn.If(
59+
shortWeak.IsAlive,
60+
"The referenced object is alive although it should have been collected",
61+
shortWeak
62+
);
63+
Assert.IsTrue(
64+
longWeak.IsAlive,
65+
"The reference object is not alive although it should still be",
66+
longWeak
67+
);
5868

5969
{
6070
var garbage = Finalizer.Instance.GetCollectedObjects();
61-
Assert.NotZero(garbage.Count);
62-
Assert.IsTrue(garbage.Any(T => ReferenceEquals(T.Target, longWeak.Target)));
71+
Assert.NotZero(garbage.Count, "There should still be garbage around");
72+
Warn.Unless(
73+
garbage.Any(T => ReferenceEquals(T.Target, longWeak.Target)),
74+
$"The {nameof(longWeak)} reference doesn't show up in the garbage list",
75+
garbage
76+
);
6377
}
64-
65-
Assert.IsFalse(called);
66-
Finalizer.Instance.CollectOnce += handler;
6778
try
6879
{
69-
Finalizer.Instance.CallPendingFinalizers();
80+
Finalizer.Instance.Collect(forceDispose: false);
7081
}
7182
finally
7283
{
7384
Finalizer.Instance.CollectOnce -= handler;
7485
}
75-
Assert.IsTrue(called);
86+
Assert.IsTrue(called, "The event handler was not called during finalization");
87+
Assert.GreaterOrEqual(objectCount, 1);
7688
}
7789

7890
private static void MakeAGarbage(out WeakReference shortWeak, out WeakReference longWeak)
@@ -85,7 +97,7 @@ private static void MakeAGarbage(out WeakReference shortWeak, out WeakReference
8597

8698
private static long CompareWithFinalizerOn(PyObject pyCollect, bool enbale)
8799
{
88-
// Must larger than 512 bytes make sure Python use
100+
// Must larger than 512 bytes make sure Python use
89101
string str = new string('1', 1024);
90102
Finalizer.Instance.Enable = true;
91103
FullGCCollect();
@@ -164,10 +176,11 @@ internal static void CreateMyPyObject(IntPtr op)
164176
public void ErrorHandling()
165177
{
166178
bool called = false;
179+
var errorMessage = "";
167180
EventHandler<Finalizer.ErrorArgs> handleFunc = (sender, args) =>
168181
{
169182
called = true;
170-
Assert.AreEqual(args.Error.Message, "MyPyObject");
183+
errorMessage = args.Error.Message;
171184
};
172185
Finalizer.Instance.Threshold = 1;
173186
Finalizer.Instance.ErrorHandler += handleFunc;
@@ -193,6 +206,7 @@ public void ErrorHandling()
193206
{
194207
Finalizer.Instance.ErrorHandler -= handleFunc;
195208
}
209+
Assert.AreEqual(errorMessage, "MyPyObject");
196210
}
197211

198212
[Test]

src/runtime/Python.Runtime.15.csproj

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@
77
<AssetTargetFallback Condition="'$(TargetFramework)'=='net40' AND $(Configuration.Contains('Mono'))">net45</AssetTargetFallback>
88
<RootNamespace>Python.Runtime</RootNamespace>
99
<AssemblyName>Python.Runtime</AssemblyName>
10-
<PackageId>Python.Runtime</PackageId>
11-
<VersionPrefix>2.4.0</VersionPrefix>
12-
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
13-
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
14-
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
15-
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
16-
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
17-
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
10+
<PackageId>pythonnet</PackageId>
11+
<VersionPrefix>2.4.1</VersionPrefix>
12+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
13+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
14+
<Title>Python for .NET</Title>
15+
<Copyright>Copyright (c) 2006-2019 the contributors of the 'Python for .NET' project</Copyright>
16+
<Description>Python and CLR (.NET and Mono) cross-platform language interop</Description>
17+
<Authors>pythonnet</Authors>
18+
<PackageLicenseUrl>https://github.com/pythonnet/pythonnet/blob/master/LICENSE</PackageLicenseUrl>
19+
<RepositoryUrl>https://github.com/pythonnet/pythonnet</RepositoryUrl>
20+
<RepositoryType>git</RepositoryType>
21+
<!--<PackageReleaseNotes>https://github.com/pythonnet/pythonnet/releases/tag/v2.4.0</PackageReleaseNotes>-->
22+
<PackageTags>python interop dynamic dlr Mono pinvoke</PackageTags>
23+
<PackageIconUrl>https://raw.githubusercontent.com/pythonnet/pythonnet/master/src/console/python-clear.ico</PackageIconUrl>
24+
<PackageProjectUrl>https://pythonnet.github.io/</PackageProjectUrl>
1825
<OutputPath>bin\</OutputPath>
1926
<AppendTargetFrameworkToOutputPath Condition="'$(TargetFramework)'=='net40'">false</AppendTargetFrameworkToOutputPath>
2027
<DocumentationFile Condition="'$(TargetFramework)'=='net40'">$(OutputPath)\$(AssemblyName).xml</DocumentationFile>

0 commit comments

Comments
 (0)