diff --git a/CHANGELOG.md b/CHANGELOG.md index f36e2d06..fe0ce5e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,15 +16,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * The implementation for `IntoPy for T` where `U: FromPy` is no longer specializable. Control the behavior of this via the implementation of `FromPy`. [#713](https://github.com/PyO3/pyo3/pull/713) * Use `parking_lot::Mutex` instead of `spin::Mutex`. [#734](https://github.com/PyO3/pyo3/pull/734) * Bumped minimum Rust version to `1.42.0-nightly 2020-01-21`. [#761](https://github.com/PyO3/pyo3/pull/761) +* `PyRef` and `PyRefMut` are renewed for `PyCell`. [#770](https://github.com/PyO3/pyo3/pull/770) ### Added * `PyCell`, which has RefCell-like features. [#770](https://github.com/PyO3/pyo3/pull/770) -* `PyClass`, `PyClassShell`, `PyObjectLayout`, `PyClassInitializer`. [#683](https://github.com/PyO3/pyo3/pull/683) +* `PyClass`, `PyLayout`, `PyClassInitializer`. [#683](https://github.com/PyO3/pyo3/pull/683) * Implemented `IntoIterator` for `PySet` and `PyFrozenSet`. [#716](https://github.com/PyO3/pyo3/pull/716) * `FromPyObject` is now automatically implemented for `T: Clone` pyclasses. [#730](https://github.com/PyO3/pyo3/pull/730) * `#[pyo3(get)]` and `#[pyo3(set)]` will now use the Rust doc-comment from the field for the Python property. [#755](https://github.com/PyO3/pyo3/pull/755) * `#[setter]` functions may now take an argument of `Pyo3::Python`. [#760](https://github.com/PyO3/pyo3/pull/760) -* New `PyRef` and `PyRefMut`. [#770](https://github.com/PyO3/pyo3/pull/770) * `PyTypeInfo::BaseLayout` and `PyClass::BaseNativeType`. [#770](https://github.com/PyO3/pyo3/pull/770) * `PyDowncastImpl`. [#770](https://github.com/PyO3/pyo3/pull/770) @@ -38,7 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Removed -* `PyRef`, `PyRefMut`, `PyRawObject`. [#683](https://github.com/PyO3/pyo3/pull/683) +* `PyRawObject`. [#683](https://github.com/PyO3/pyo3/pull/683) * `PyNoArgsFunction`. [#741](https://github.com/PyO3/pyo3/pull/741) * `initialize_type()`. To set the module name for a `#[pyclass]`, use the `module` argument to the macro. #[751](https://github.com/PyO3/pyo3/pull/751) * `AsPyRef::as_mut/with/with_mut/into_py/into_mut_py`. [#770](https://github.com/PyO3/pyo3/pull/770) diff --git a/src/pycell.rs b/src/pycell.rs index 8dba97d7..2a5500c8 100644 --- a/src/pycell.rs +++ b/src/pycell.rs @@ -64,7 +64,7 @@ impl AsPyPointer for PyCellInner { unsafe impl PyLayout for PyCellInner { const IS_NATIVE_TYPE: bool = false; - fn get_super_or(&mut self) -> Option<&mut T::BaseLayout> { + fn get_super(&mut self) -> Option<&mut T::BaseLayout> { Some(&mut self.ob_base) } unsafe fn get_ptr(&self) -> *mut T { @@ -350,7 +350,7 @@ impl PyCell { unsafe impl PyLayout for PyCell { const IS_NATIVE_TYPE: bool = false; - fn get_super_or(&mut self) -> Option<&mut T::BaseLayout> { + fn get_super(&mut self) -> Option<&mut T::BaseLayout> { Some(&mut self.inner.ob_base) } unsafe fn get_ptr(&self) -> *mut T { diff --git a/src/pyclass.rs b/src/pyclass.rs index a3e0f375..f9d1441c 100644 --- a/src/pyclass.rs +++ b/src/pyclass.rs @@ -78,7 +78,7 @@ pub trait PyClass: /// Specify this class has `#[pyclass(weakref)]` or not. type WeakRef: PyClassWeakRef; /// The closest native ancestor. This is `PyAny` by default, and when you declare - /// `#[pyclass(extends=PyList)]`, it's `PyList`. + /// `#[pyclass(extends=PyDict)]`, it's `PyDict`. type BaseNativeType: PyTypeInfo + PyNativeType; } diff --git a/src/pyclass_init.rs b/src/pyclass_init.rs index 14ced26c..3be018f2 100644 --- a/src/pyclass_init.rs +++ b/src/pyclass_init.rs @@ -133,7 +133,7 @@ impl PyObjectInit for PyClassInitializer { unsafe { layout.py_init(init); } - if let Some(super_obj) = layout.get_super_or() { + if let Some(super_obj) = layout.get_super() { super_init.init_class(super_obj); } } diff --git a/src/type_object.rs b/src/type_object.rs index 939f26d2..4530b1b0 100644 --- a/src/type_object.rs +++ b/src/type_object.rs @@ -16,7 +16,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; /// This trait is intended to be used internally. pub unsafe trait PyLayout { const IS_NATIVE_TYPE: bool = true; - fn get_super_or(&mut self) -> Option<&mut T::BaseLayout> { + fn get_super(&mut self) -> Option<&mut T::BaseLayout> { None } unsafe fn py_init(&mut self, _value: T) {}