This release contains some fixes to compile-time edge cases for the PyO3 0.21 series:
A missing deprecation warning for the GIL Ref constructor PySet::empty has now been added.
#[pymodule] functions will no longer trigger missing_docs lints on their generated code.
Incorrect implementations of __traverse__ in #[pymethods] will now emit a better error.
Extension modules on AIX will now link to libpython.
This release also fixes some compile errors for the experimental-async and experimental-declarative-modules features, and corrects some documentation typos.
Thank you to the following users for the improvements:
This release is a set of touch-ups to PyO3 0.21 to fix cases found as adoption of PyO3 0.21.0 progressed.
The new PyBackedStr and PyBackedBytes types have had a large range of standard traits implemented, including Clone, PartialEq, Hash, PartialOrd, Display, Debug, Send and Sync.
The argument to a #[setter] function now accepts the full range of input types as any other function argument in a #[pymethods] block, and will now correctly handle a #[pyo3(from_py_with = "...")] annotation.
Some procedural macro output has been adjusted to reuse more code and make it easier to reach complete code coverage in projects using PyO3. The import_exception_bound! macro has been added to further assist with coverage during migration, by skipping generating code which is only needed to use the exception as a GIL Ref.
Finally, the experimental-async feature now correctly handles async fn in #[pymethods] which have a &self or &mut self receiver plus additional arguments.
Thank you to the following users for the improvements:
This release introduces a substantial new direction for PyO3's API. The Bound<'py, T> smart pointer type has been added that replaces "GIL Refs" such as &'py PyAny and &'py PyList with smart-pointer forms Bound<'py, PyAny> and Bound<'py, PyList>. This new smart pointer brings ownership out of PyO3's internals and into user control. This has been done for sake of both performance and soundness.
The migration guide extensively details the intended transition to the new API. To allow users a more graceful upgrade path, PyO3 0.21 and 0.22 will maintain backwards compatibility support for the existing "GIL Refs" API.
As well as the Bound API, highlights of PyO3 0.21 include:
Support for compiling for GraalPy
Extended chrono / datetime conversions, including support for the abi3 feature and the chrono-tz crate
FromPyObject, IntoPy<PyObject> and ToPyObject are implemented on std::duration::Duration#3670
Add PyString::to_cow. Add Py<PyString>::to_str, Py<PyString>::to_cow, and Py<PyString>::to_string_lossy, as ways to access Python string data safely beyond the GIL lifetime. #3677
Add Bound<T> and Borrowed<T> smart pointers as a new API for accessing Python objects. #3686
Add PyNativeType::as_borrowed to convert "GIL refs" to the new Bound smart pointer. #3692
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 show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@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.20.3 to 0.21.2.
Release notes
Sourced from pyo3's releases.
... (truncated)
Changelog
Sourced from pyo3's changelog.
... (truncated)
Commits
a646a82
release: 0.21.2bd15f92
Deprecate thePySet::empty
gil-ref constructor (#4082)4f7c706
Suppress non_local_definitions lint as we often want the non-local effects in...3f6faf0
Extend guide on interaction between method receivers and lifetime elision. (#...4e13c0e
Link libpython for AIX target (#4073)e501377
fix declarative-modules compile error (#4054)fd18955
add#[doc(hidden)]
to the Rust module created by#[pymodule]
(#4067)e174a04
Minor: Fix a typo in Contributing.md (#4066)a8abe50
build(deps): bump peaceiris/actions-gh-pages from 3 to 4 (#4062)68d1973
Fix typo (#4052)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 show