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

Skip to content

Fix missing Incref for Namespace and Assembly #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@
- ([@rico-chet](https://github.com/rico-chet))
- ([@rmadsen-ks](https://github.com/rmadsen-ks))
- ([@stonebig](https://github.com/stonebig))
- ([@testrunner123](https://github.com/testrunner123))

11 changes: 5 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
## [unreleased][]

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


### Changed

- Changed `Bar` feature

### Fixed

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

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

Expand Down
2 changes: 2 additions & 0 deletions src/runtime/typemanager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr
if (0 != Runtime.PyMapping_HasKey(py_dict, assemblyKey.Handle))
{
var pyAssembly = new PyObject(Runtime.PyDict_GetItem(py_dict, assemblyKey.Handle));
Runtime.XIncref(pyAssembly.Handle);
disposeList.Add(pyAssembly);
if (!Converter.ToManagedValue(pyAssembly.Handle, typeof(string), out assembly, false))
{
Expand All @@ -218,6 +219,7 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr
if (0 != Runtime.PyMapping_HasKey(py_dict, namespaceKey.Handle))
{
var pyNamespace = new PyObject(Runtime.PyDict_GetItem(py_dict, namespaceKey.Handle));
Runtime.XIncref(pyNamespace.Handle);
disposeList.Add(pyNamespace);
if (!Converter.ToManagedValue(pyNamespace.Handle, typeof(string), out namespaceStr, false))
{
Expand Down
3 changes: 0 additions & 3 deletions src/tests/test_subclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def OnTestEvent(self, value):
return DerivedEventTest


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


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


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