added regression test for https://github.com/pythonnet/pythonnet/issu… · pythonnet/pythonnet@d975d5f

Original file line numberDiff line numberDiff line change

@@ -290,3 +290,19 @@ def __init__(self, i, s):

290290

assert len(calls) == 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()