PyO3 v0.6.0 Release Notes

Release Date: 2019-03-28 // about 5 years ago
  • Regressions

    • Currently, #341 causes cargo test to fail with weird linking errors when the extension-module feature is activated. For now you can work around this by making the extension-module feature optional and running the tests with cargo test --no-default-features:
    [dependencies.pyo3]
    version = "0.6.0"
    
    [features]
    extension-module = ["pyo3/extension-module"]
    default = ["extension-module"]
    

    โž• Added

    • Added a wrap_pymodule! macro similar to the existing wrap_pyfunction! macro. Only available on python 3
    • Added support for cross compiling (e.g. to arm v7) by mtp401 in #327. See the "Cross Compiling" section in the "Building and Distribution" chapter of the guide for more details.
    • The PyRef and PyRefMut types, which allow to differentiate between an instance of a rust struct on the rust heap and an instance that is embedded inside a python object. By kngwyu in #335
    • Added FromPy<T> and IntoPy<T> which are equivalent to From<T> and Into<T> except that they require a gil token.
    • Added ManagedPyRef, which should eventually replace ToBorrowedObject.

    ๐Ÿ”„ Changed

    • Renamed PyObjectRef to PyAny in #388
    • Renamed add_function to add_wrapped as it now also supports modules.
    • Renamed #[pymodinit] to #[pymodule]
    • py.init(|| value) becomes Py::new(value)
    • py.init_ref(|| value) becomes PyRef::new(value)
    • py.init_mut(|| value) becomes PyRefMut::new(value).
    • PyRawObject::init is now infallible, e.g. it returns () instead of PyResult<()>.
    • Renamed py_exception! to create_exception! and refactored the error macros.
    • Renamed wrap_function! to wrap_pyfunction!
    • Renamed #[prop(get, set)] to #[pyo3(get, set)]
    • #[pyfunction] now supports the same arguments as #[pyfn()]
    • Some macros now emit proper spanned errors instead of panics.
    • Migrated to the 2018 edition
    • crate::types::exceptions moved to crate::exceptions
    • Replace IntoPyTuple with IntoPy<Py<PyTuple>>.
    • IntoPyPointer and ToPyPointer moved into the crate root.
    • class::CompareOp moved into class::basic::CompareOp
    • PyTypeObject is now a direct subtrait PyTypeCreate, removing the old cyclical implementation in #350
    • Add PyList::{sort, reverse} by chr1sj0nes in #357 and #358
    • Renamed the typeob module to type_object

    โœ‚ Removed

    • PyToken was removed due to unsoundness (See #94).
    • Removed the unnecessary type parameter from PyObjectAlloc
    • NoArgs. Just use an empty tuple
    • PyObjectWithGIL. PyNativeType is sufficient now that PyToken is removed.

    ๐Ÿ›  Fixed

    • A soudness hole where every instances of a #[pyclass] struct was considered to be part of a python object, even though you can create instances that are not part of the python heap. This was fixed through PyRef and PyRefMut.
    • Fix kwargs support in #328.
    • Add full support for __dict__ in #403.