Skip to content

Commit 837fba8

Browse files
committed
Updated mark method for Series to avoid panic
1 parent e949d12 commit 837fba8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ext/polars/src/series/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ pub fn mark_series(marker: &gc::Marker, series: &Series) {
6363

6464
impl DataTypeFunctions for RbSeries {
6565
fn mark(&self, marker: &gc::Marker) {
66-
mark_series(marker, &self.series.borrow());
66+
// this is not ideal, as objects will not be marked if unable to borrow
67+
// this should never happen, but log for now to avoid panic,
68+
// as most series will not use Object datatype
69+
if let Ok(s) = &self.series.try_borrow() {
70+
mark_series(marker, s);
71+
} else {
72+
eprintln!("[polars] Could not borrow!");
73+
}
6774
}
6875
}

0 commit comments

Comments
 (0)