()
| 361 | reason="3.14.0b1/2 managed dict bug: https://github.com/python/cpython/issues/133912", |
| 362 | ) |
| 363 | def test_cyclic_gc(): |
| 364 | # One object references itself |
| 365 | instance = m.DynamicClass() |
| 366 | instance.circular_reference = instance |
| 367 | |
| 368 | cstats = ConstructorStats.get(m.DynamicClass) |
| 369 | assert cstats.alive() == 1 |
| 370 | del instance |
| 371 | pytest.gc_collect() |
| 372 | assert cstats.alive() == 0 |
| 373 | |
| 374 | # Two object reference each other |
| 375 | i1 = m.DynamicClass() |
| 376 | i2 = m.DynamicClass() |
| 377 | i1.cycle = i2 |
| 378 | i2.cycle = i1 |
| 379 | |
| 380 | assert cstats.alive() == 2 |
| 381 | del i1, i2 |
| 382 | pytest.gc_collect() |
| 383 | assert cstats.alive() == 0 |
| 384 | |
| 385 | |
| 386 | @pytest.mark.xfail("env.PYPY", strict=False) |
nothing calls this directly
no test coverage detected