8000 added regression test for https://github.com/pythonnet/pythonnet/issu… · pythonnet/pythonnet@4ff080e · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 4ff080e

Browse files
committed
added regression test for #1565 (unable to gc collect an instance of python derived type)
1 parent 70b684a commit 4ff080e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_subclass.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,19 @@ def __init__(self, i, s):
290290
assert len(calls) < 9813 span class=pl-c1>== 1
291291
assert calls[0][0] == 1
292292
assert calls[0][1] == "foo"
293+
294+
# regression test for https://github.com/pythonnet/pythonnet/issues/1565
295+
def test_can_be_collected_by_gc():
296+
from Python.Test import BaseClass
297+
298+
class Derived(BaseClass):
299+
__namespace__ = 'test_can_be_collected_by_gc'
300+
301+
inst = Derived()
302+
cycle = [inst]
303+
del inst
304+
cycle.append(cycle)
305+
del cycle
306+
307+
import gc
308+
gc.collect()

0 commit comments

Comments
 (0)
0