Mercurial > hg
diff rust/hg-cpython/src/dirstate/dirs_multiset.rs @ 43286:f8c114f20d2d
rust-cpython: require GIL to borrow immutable reference from PySharedRefCell
Since the inner value may be leaked, we probably need GIL to guarantee that
there's no data race.
inner(py).borrow() is replaced with inner_shared(py).borrow(), which basically
means any PySharedRefCell data should be accessed through PySharedRef wrapper.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 21 Sep 2019 17:15:50 +0900 |
parents | ffc1fbd7d1f5 |
children | b9f791090211 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs Sun Sep 15 22:19:10 2019 +0900 +++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs Sat Sep 21 17:15:50 2019 +0900 @@ -100,7 +100,7 @@ } def __contains__(&self, item: PyObject) -> PyResult<bool> { - Ok(self.inner(py).borrow().contains(HgPath::new( + Ok(self.inner_shared(py).borrow().contains(HgPath::new( item.extract::<PyBytes>(py)?.data(py).as_ref(), ))) }