Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfce5e2

Browse files
testrunner123filmor
authored andcommitted
Fix missing Incref for Namespace and Assembly (#482)
Fix crash of python interpreter 3.5 64-bit in garbage collector
1 parent 550a027 commit bfce5e2

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

AUTHORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@
4343
- ([@rico-chet](https://github.com/rico-chet))
4444
- ([@rmadsen-ks](https://github.com/rmadsen-ks))
4545
- ([@stonebig](https://github.com/stonebig))
46+
- ([@testrunner123](https://github.com/testrunner123))
47+

CHANGELOG.md

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

1010
### Added
11-
- Added clr.GetClrType (#432)(#433)
12-
- Allowed passing None for nullable args (#460)
11+
- Added `clr.GetClrType` (#432, #433)
12+
- Allowed passing `None` for nullable args (#460)
1313
- Added keyword arguments based on C# syntax for calling CPython methods (#461)
1414

15-
1615
### Changed
1716

18-
- Changed `Bar` feature
19-
2017
### Fixed
2118

2219
- Fixed Visual Studio 2017 compat (#434) for setup.py
23-
- Fixed `FooBar` bug
20+
- Fixed crash on exit of the Python interpreter if a python class
21+
derived from a .NET class has a `__namespace__` or `__assembly__`
22+
attribute (#481)
2423

2524
## [2.3.0][] - 2017-03-11
2625

src/runtime/typemanager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr
206206
if (0 != Runtime.PyMapping_HasKey(py_dict, assemblyKey.Handle))
207207
{
208208
var pyAssembly = new PyObject(Runtime.PyDict_GetItem(py_dict, assemblyKey.Handle));
209+
Runtime.XIncref(pyAssembly.Handle);
209210
disposeList.Add(pyAssembly);
210211
if (!Converter.ToManagedValue(pyAssembly.Handle, typeof(string), out assembly, false))
211212
{
@@ -218,6 +219,7 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr
218219
if (0 != Runtime.PyMapping_HasKey(py_dict, namespaceKey.Handle))
219220
{
220221
var pyNamespace = new PyObject(Runtime.PyDict_GetItem(py_dict, namespaceKey.Handle));
222+
Runtime.XIncref(pyNamespace.Handle);
221223
disposeList.Add(pyNamespace);
222224
if (!Converter.ToManagedValue(pyNamespace.Handle, typeof(string), out namespaceStr, false))
223225
{

src/tests/test_subclass.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def OnTestEvent(self, value):
8585
return DerivedEventTest
8686

8787

88-
@pytest.mark.skip(reason="FIXME: test randomly pass/fails")
8988
def test_base_class():
9089
"""Test base class managed type"""
9190
ob = SubClassTest()
@@ -98,7 +97,6 @@ def test_base_class():
9897
assert list(SubClassTest.test_list(ob)) == ["a", "b", "c"]
9998

10099

101-
@pytest.mark.skip(reason="FIXME: test randomly pass/fails")
102100
def test_interface():
103101
"""Test python classes can derive from C# interfaces"""
104102
InterfaceTestClass = interface_test_class_fixture()
@@ -112,7 +110,6 @@ def test_interface():
112110
assert id(x) == id(ob)
113111

114112

115-
@pytest.mark.skip(reason="FIXME: test randomly pass/fails")
116113
def test_derived_class():
117114
"""Test python class derived from managed type"""
118115
DerivedClass = derived_class_fixture()

0 commit comments

Comments
 (0)