Skip to content

Commit ef42990

Browse files
committed
Revert "revert gc"
1 parent 2c6bb7a commit ef42990

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/stdlib/src/gc.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub(crate) use gc::module_def;
22

33
#[pymodule]
44
mod gc {
5-
use crate::vm::{PyResult, VirtualMachine, function::FuncArgs};
5+
use crate::vm::{PyObjectRef, PyResult, VirtualMachine, function::FuncArgs};
66

77
#[pyfunction]
88
fn collect(_args: FuncArgs, _vm: &VirtualMachine) -> i32 {
@@ -45,8 +45,10 @@ mod gc {
4545
}
4646

4747
#[pyfunction]
48-
fn get_referrers(_args: FuncArgs, vm: &VirtualMachine) -> PyResult {
49-
Err(vm.new_not_implemented_error(""))
48+
fn get_referrers(_args: FuncArgs, vm: &VirtualMachine) -> PyObjectRef {
49+
// RustPython does not support bi-directional reference tracking.
50+
// Return empty list for compatibility with reference cycle tests.
51+
vm.ctx.new_list(vec![]).into()
5052
}
5153

5254
#[pyfunction]

0 commit comments

Comments
 (0)