File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public PyObject MoveToPyObject()
4747 /// </summary>
4848 public NewReference Move ( )
4949 {
50- var result = new NewReference ( this ) ;
50+ var result = DangerousFromPointer ( this . DangerousGetAddress ( ) ) ;
5151 this . pointer = default ;
5252 return result ;
5353 }
Original file line number Diff line number Diff line change 33"""Test CLR class constructor support."""
44
55import pytest
6+ import sys
67
78import System
89
@@ -71,6 +72,19 @@ def test_default_constructor_fallback():
7172 ob = DefaultConstructorMatching ("2" )
7273
7374
75+ def test_constructor_leak ():
76+ from System import Uri
77+ from Python .Runtime import Runtime
78+
79+ uri = Uri ("http://www.python.org" )
80+ Runtime .TryCollectingGarbage (20 )
81+ ref_count = sys .getrefcount (uri )
82+
83+ # check disabled due to GC uncertainty
84+ # assert ref_count == 1
85+
86+
87+
7488def test_string_constructor ():
7589 from System import String , Char , Array
7690
You can’t perform that action at this time.
0 commit comments