Re: [PATCH 7 of 7] rust-cpython: leverage py_shared_iterator::from_inner() where appropriate

2019-09-09 Thread Augie Fackler
On Mon, Sep 09, 2019 at 03:59:56PM +0200, Raphaël Gomès wrote:
> Looking back, my initial macro was a bit over-engineered, the concrete types
> should be an improvement to maintainability, since they're restricted to one
> `py_class!`.
>
> This whole series looks good to me, thanks a lot.
>
> On 9/8/19 12:05 PM, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara 
> > # Date 1567916635 -32400
> > #  Sun Sep 08 13:23:55 2019 +0900
> > # Node ID 8174e0c96c14e5b5e2309a9de1a90b7c446b5aab
> > # Parent  1fa833aa2e43f6b3055d618755f10daeefacb0ae
> > rust-cpython: leverage py_shared_iterator::from_inner() where appropriate

queued per Raphael's review, thanks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 7 of 7] rust-cpython: leverage py_shared_iterator::from_inner() where appropriate

2019-09-09 Thread Raphaël Gomès
Looking back, my initial macro was a bit over-engineered, the concrete 
types should be an improvement to maintainability, since they're 
restricted to one `py_class!`.


This whole series looks good to me, thanks a lot.

On 9/8/19 12:05 PM, Yuya Nishihara wrote:

# HG changeset patch
# User Yuya Nishihara 
# Date 1567916635 -32400
#  Sun Sep 08 13:23:55 2019 +0900
# Node ID 8174e0c96c14e5b5e2309a9de1a90b7c446b5aab
# Parent  1fa833aa2e43f6b3055d618755f10daeefacb0ae
rust-cpython: leverage py_shared_iterator::from_inner() where appropriate

diff --git a/rust/hg-cpython/src/dirstate/dirs_multiset.rs 
b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
@@ -90,10 +90,10 @@ py_class!(pub class Dirs |py| {
  }
  def __iter__() -> PyResult {
  let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? };
-DirsMultisetKeysIterator::create_instance(
+DirsMultisetKeysIterator::from_inner(
  py,
-RefCell::new(Some(leak_handle)),
-RefCell::new(leaked_ref.iter()),
+leak_handle,
+leaked_ref.iter(),
  )
  }
  
diff --git a/rust/hg-cpython/src/ref_sharing.rs b/rust/hg-cpython/src/ref_sharing.rs

--- a/rust/hg-cpython/src/ref_sharing.rs
+++ b/rust/hg-cpython/src/ref_sharing.rs
@@ -309,10 +309,10 @@ macro_rules! py_shared_ref {
  ///
  /// def __iter__() -> PyResult {
  /// let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? 
};
-/// MyTypeItemsIterator::create_instance(
+/// MyTypeItemsIterator::from_inner(
  /// py,
-/// RefCell::new(Some(leak_handle)),
-/// RefCell::new(leaked_ref.iter()),
+/// leak_handle,
+/// leaked_ref.iter(),
  /// )
  /// }
  /// });
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 7 of 7] rust-cpython: leverage py_shared_iterator::from_inner() where appropriate

2019-09-08 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1567916635 -32400
#  Sun Sep 08 13:23:55 2019 +0900
# Node ID 8174e0c96c14e5b5e2309a9de1a90b7c446b5aab
# Parent  1fa833aa2e43f6b3055d618755f10daeefacb0ae
rust-cpython: leverage py_shared_iterator::from_inner() where appropriate

diff --git a/rust/hg-cpython/src/dirstate/dirs_multiset.rs 
b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
@@ -90,10 +90,10 @@ py_class!(pub class Dirs |py| {
 }
 def __iter__() -> PyResult {
 let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? };
-DirsMultisetKeysIterator::create_instance(
+DirsMultisetKeysIterator::from_inner(
 py,
-RefCell::new(Some(leak_handle)),
-RefCell::new(leaked_ref.iter()),
+leak_handle,
+leaked_ref.iter(),
 )
 }
 
diff --git a/rust/hg-cpython/src/ref_sharing.rs 
b/rust/hg-cpython/src/ref_sharing.rs
--- a/rust/hg-cpython/src/ref_sharing.rs
+++ b/rust/hg-cpython/src/ref_sharing.rs
@@ -309,10 +309,10 @@ macro_rules! py_shared_ref {
 ///
 /// def __iter__() -> PyResult {
 /// let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? 
};
-/// MyTypeItemsIterator::create_instance(
+/// MyTypeItemsIterator::from_inner(
 /// py,
-/// RefCell::new(Some(leak_handle)),
-/// RefCell::new(leaked_ref.iter()),
+/// leak_handle,
+/// leaked_ref.iter(),
 /// )
 /// }
 /// });
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel