Skip to content
Merged
Prev Previous commit
Next Next commit
Add candidates/duration to gc callback info, mark v3.15 test failures
  • Loading branch information
youknowone committed Mar 10, 2026
commit dfee9903ddf5d8212f7da77195ebfd8e7d14d406
4 changes: 4 additions & 0 deletions Lib/test/test_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def test_function(self):
# is 3 because it includes f's code object.
self.assertIn(gc.collect(), (2, 3))

# TODO: RUSTPYTHON - weakref clear ordering differs from 3.15+
@unittest.expectedFailure
def test_function_tp_clear_leaves_consistent_state(self):
# https://github.com/python/cpython/issues/91636
code = """if 1:
Expand Down Expand Up @@ -309,6 +311,8 @@ def func():
self.assertRegex(stdout, rb"""\A\s*func=None""")
self.assertFalse(stderr)

# TODO: RUSTPYTHON - _datetime module not available
@unittest.expectedFailure
def test_datetime_weakref_cycle(self):
# https://github.com/python/cpython/issues/132413
# If the weakref used by the datetime extension gets cleared by the GC (due to being
Expand Down
2 changes: 2 additions & 0 deletions crates/vm/src/stdlib/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ mod gc {
vm.ctx.new_int(result.uncollectable).into(),
vm,
);
let _ = info.set_item("candidates", vm.ctx.new_int(result.candidates).into(), vm);
let _ = info.set_item("duration", vm.ctx.new_float(result.duration).into(), vm);

for callback in callbacks {
let _ = callback.call((phase_str.clone(), info.clone()), vm);
Expand Down