Skip to content

Commit e6ea143

Browse files
committed
gc.garbage
1 parent d690b2d commit e6ea143

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

crates/stdlib/src/gc.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ pub(crate) use gc::make_module;
22

33
#[pymodule]
44
mod gc {
5-
use crate::vm::{PyResult, VirtualMachine, function::FuncArgs};
5+
use crate::vm::{PyObjectRef, PyResult, VirtualMachine, function::FuncArgs};
6+
7+
/// A list of objects which the collector found to be unreachable
8+
/// but could not be freed. RustPython doesn't have cyclic GC,
9+
/// so this is always an empty list.
10+
#[pyattr]
11+
fn garbage(vm: &VirtualMachine) -> PyObjectRef {
12+
vm.ctx.new_list(vec![]).into()
13+
}
614

715
#[pyfunction]
816
fn collect(_args: FuncArgs, _vm: &VirtualMachine) -> i32 {

0 commit comments

Comments
 (0)