diff -r 281642cd1d04 -r bad4e7b361d2 rust/hg-cpython/src/dirstate/dirs_multiset.rs --- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs Sat Jan 25 17:21:06 2020 +0900 +++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs Sat Jan 25 17:26:23 2020 +0900 @@ -13,11 +13,10 @@ use cpython::{ exc, ObjectProtocol, PyBytes, PyClone, PyDict, PyErr, PyObject, PyResult, - Python, + Python, UnsafePyLeaked, }; use crate::dirstate::extract_dirstate; -use crate::ref_sharing::{PyLeaked, PySharedRefCell}; use hg::{ utils::hg_path::{HgPath, HgPathBuf}, DirsMultiset, DirsMultisetIter, DirstateMapError, DirstateParseError, @@ -25,7 +24,7 @@ }; py_class!(pub class Dirs |py| { - data inner_: PySharedRefCell; + @shared data inner: DirsMultiset; // `map` is either a `dict` or a flat iterator (usually a `set`, sometimes // a `list`) @@ -65,10 +64,7 @@ })? }; - Self::create_instance( - py, - PySharedRefCell::new(inner), - ) + Self::create_instance(py, inner) } def addpath(&self, path: PyObject) -> PyResult { @@ -123,11 +119,9 @@ } }); -py_shared_ref!(Dirs, DirsMultiset, inner_, inner); - impl Dirs { pub fn from_inner(py: Python, d: DirsMultiset) -> PyResult { - Self::create_instance(py, PySharedRefCell::new(d)) + Self::create_instance(py, d) } fn translate_key( @@ -140,7 +134,7 @@ py_shared_iterator!( DirsMultisetKeysIterator, - PyLeaked>, + UnsafePyLeaked>, Dirs::translate_key, Option );