This release of PyO3 brings support for Python 3.10 and PyPy 3.8. In addition, new optional dependencies on anyhow and eyre have been added for easy integration of the popular error-handling libraries with Python code.
A number of consistency improvements have been made to PyList, PyTuple and PySequence APIs. They now all exclusively use usize- based indexing, and now also support Rust's indexing operator.
In this release #[pymethods] are now able to implement many magic methods such as __str__ and __repr__, removing the need for #[pyproto] macro implementations. For the 0.15 release series both #[pymethods] and #[pyproto] will be supported; #[pyproto] is expected to be deprecated in the future.
For full details of all changes, see the CHANGELOG. For help with upgrading, see the migration guide.
Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback.
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 and PySequence's APIs now accepts only usize indices instead of isize.
#1733, #1802,
#1803
PyList::get_item and PyTuple::get_item now return PyResult<&PyAny> instead of panicking. #1733
PySequence::in_place_repeat and PySequence::in_place_concat now return PyResult<&PySequence> instead of PyResult<()>, which is needed in case of immutable sequences such as tuples. #1803
PySequence::get_slice now returns PyResult<&PySequence> instead of PyResult<&PyAny>. #1829
Deprecate PyTuple::slice, new method PyTuple::get_slice added with usize 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, and Py_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 and PySys_HasWarnOptions. #1887
Deprecate #[call] attribute in favor of using fn __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 with abi3. #1880
Fix FFI definition for PyTuple_ClearFreeList incorrectly being present for Python 3.9 and up. #1887
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps pyo3 from 0.14.5 to 0.15.0.
Release notes
Sourced from pyo3's releases.
Changelog
Sourced from pyo3's changelog.
... (truncated)
Commits
4774744
release: 0.15.064df791
Merge pull request #1964 from PyO3/pymethods-args9ce363a
guide: add hints for the signature of pymethods protos39d2b9d
Merge pull request #1957 from davidhewitt/fetch-if-setf801c19
err: addPyErr::take
7b9ae8e
Clean upPython
documentation (#1963)0f92f28
Merge pull request #1958 from davidhewitt/pymethods-protos-arguments-cleanup6a3e1e7
macros: clean up protocol argument extraction a bitbfe7086
Merge pull request #1954 from PyO3/feature-fix50df2c7
Merge pull request #1955 from PyO3/cargo-toml-depsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)