PyO3 v0.15.0 Release Notes
Release Date: 2021-11-03 // over 2 years ago-
Packaging
pyo3
'sCargo.toml
now advertiseslinks = "python"
to inform Cargo that it links against libpython. #1819- โ Added optional
anyhow
feature to convertanyhow::Error
intoPyErr
. #1822 - ๐ Support Python 3.10. #1889
- โ Added optional
eyre
feature to converteyre::Report
intoPyErr
. #1893 - ๐ Support PyPy 3.8. #1948
โ Added
- Add
PyList::get_item_unchecked
andPyTuple::get_item_unchecked
to get items without bounds checks. #1733 - ๐ Support
#[doc = include_str!(...)]
attributes on Rust 1.54 and up. #1746 - โ Add
PyAny::py
as a convenience forPyNativeType::py
. #1751 - โ Add implementation of
std::ops::Index<usize>
forPyList
,PyTuple
andPySequence
. #1825 - โ Add range indexing implementations of
std::ops::Index
forPyList
,PyTuple
andPySequence
. #1829 - โ Add
PyMapping
type to represent the Python mapping protocol. #1844 - โ Add commonly-used sequence methods to
PyList
andPyTuple
. #1849 - โ Add
as_sequence
methods toPyList
andPyTuple
. #1860 - โ Add support for magic methods in
#[pymethods]
, intended as a replacement for#[pyproto]
. #1864 - โ Add
abi3-py310
feature. #1889 - โ Add
PyCFunction::new_closure
to create a Python function from a Rust closure. #1901 - โ Add support for positional-only arguments in
#[pyfunction]
. #1925 - โ Add
PyErr::take
to attempt to fetch a Python exception if present. #1957
๐ Changed
PyList
,PyTuple
andPySequence
's APIs now accepts onlyusize
indices instead ofisize
. #1733, #1802, #1803PyList::get_item
andPyTuple::get_item
now returnPyResult<&PyAny>
instead of panicking. #1733PySequence::in_place_repeat
andPySequence::in_place_concat
now returnPyResult<&PySequence>
instead ofPyResult<()>
, which is needed in case of immutable sequences such as tuples. #1803PySequence::get_slice
now returnsPyResult<&PySequence>
instead ofPyResult<&PyAny>
. #1829- ๐ Deprecate
PyTuple::split_from
. #1804 - ๐ Deprecate
PyTuple::slice
, new methodPyTuple::get_slice
added withusize
indices. #1828 - ๐ Deprecate FFI definitions
PyParser_SimpleParseStringFlags
,PyParser_SimpleParseStringFlagsFilename
,PyParser_SimpleParseFileFlags
when building for Python 3.9. #1830 - ๐ Mark FFI definitions removed in Python 3.10
PyParser_ASTFromString
,PyParser_ASTFromStringObject
,PyParser_ASTFromFile
,PyParser_ASTFromFileObject
,PyParser_SimpleParseStringFlags
,PyParser_SimpleParseStringFlagsFilename
,PyParser_SimpleParseFileFlags
,PyParser_SimpleParseString
,PyParser_SimpleParseFile
,Py_SymtableString
, andPy_SymtableStringObject
. #1830 - ๐
#[pymethods]
now handles magic methods similarly to#[pyproto]
. In the future,#[pyproto]
may be deprecated. #1864 - โ Deprecate FFI definitions
PySys_AddWarnOption
,PySys_AddWarnOptionUnicode
andPySys_HasWarnOptions
. #1887 - Deprecate
#[call]
attribute in favor of usingfn __call__
. #1929 - Fix missing FFI definition
_PyImport_FindExtensionObject
on Python 3.10. #1942 - ๐ Change
PyErr::fetch
to panic in debug mode if no exception is present. #1957
๐ Fixed
- ๐ Fix building with a conda environment on Windows. #1873
- ๐ Fix panic on Python 3.6 when calling
Python::with_gil
with Python initialized but threading not initialized. #1874 - ๐ Fix incorrect linking to version-specific DLL instead of
python3.dll
when cross-compiling to Windows withabi3
. #1880 - ๐ Fix FFI definition for
PyTuple_ClearFreeList
incorrectly being present for Python 3.9 and up. #1887 - ๐ Fix panic in generated
#[derive(FromPyObject)]
for enums. #1888 - ๐ Fix cross-compiling to Python 3.7 builds with the "m" abi flag. #1908
- Fix
__mod__
magic method fallback to__rmod__
. #1934. - Fix missing FFI definition
_PyImport_FindExtensionObject
on Python 3.10. #1942