This release introduces support for Python 3.13. Please note that Python 3.13 is still in beta, and while breaking changes are not expected it is very possible that code compiled against Python 3.13 beta versions will be incompatible with the final 3.13 release later in the year.
The minimum supported Rust version has been increased to Rust 1.63.
PyO3's deferred reference counting used to implement Clone for Py<T> without the global interpreter lock has been demonstrated to be impossible to implement safely in the general case and has consequently been changed to panic instead of deferring when cloning Py<T> without the GIL being held. Given the nature of panics inside Clone operations being a potential footgun, this implementation has been moved behind the opt-in py-clone feature.
Other particularly notable changes include:
The #[pyclass] macro now has additional options #[pyclass(eq, ord, hash)] to automatically generate Python implementations for equality, ordering and hashing based upon the Rust PartialEq, PartialOrd and Hash traits. This can ensure consistency and reduce boilerplate compared to implementing __eq__, __hash__ and so on manually.
The experimental-declarative-modules feature to support #[pymodule] on Rust mod items has been stabilised (and the feature flag removed). The existing implementation of #[pymodule] on fn items is still present but soft-deprecated; in the future new features will likely be added only to declarative modules, and the fn modules may eventually be deprecated and removed.
The GIL Refs API deprecation started in PyO3 0.21 continues with all related APIs now being gated behind the gil-refs feature, and unconditionally deprecated. In PyO3 0.23 these APIs are expected to be removed.
There have been numerous other smaller improvements, changes and fixes. For full details see the CHANGELOG.
Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following contributors' commits are included in this release:
Add PyWeakref, PyWeakrefReference and PyWeakrefProxy. #3835
Support #[pyclass] on enums that have tuple variants. #4072
Add support for scientific notation in Decimal conversion. #4079
Add pyo3_disable_reference_pool conditional compilation flag to avoid the overhead of the global reference pool at the cost of known limitations as explained in the performance section of the guide. #4095
Add #[pyo3(constructor = (...))] to customize the generated constructors for complex enum variants. #4158
Add PyType::module, which always matches Python __module__. #4196
Add PyType::fully_qualified_name which matches the "fully qualified name" defined in PEP 737. #4196
Add PyTypeMethods::mro and PyTypeMethods::bases. #4197
Add #[pyclass(ord)] to implement ordering based on PartialOrd. #4202
Implement ToPyObject and IntoPy<PyObject> for PyBackedStr and PyBackedBytes. #4205
Add #[pyclass(hash)] option to implement __hash__ in terms of the Hash implementation #4206
Add #[pyclass(eq)] option to generate __eq__ based on PartialEq, and #[pyclass(eq_int)] for simple enums to implement equality based on their discriminants. #4210
Implement From<Bound<'py, T>> for PyClassInitializer<T>. #4214
Add as_super methods to PyRef and PyRefMut for accesing the base class by reference. #4219
Implement PartialEq<str> for Bound<'py, PyString>. #4245
Implement PyModuleMethods::filename on PyPy. #4249
Implement PartialEq<[u8]> for Bound<'py, PyBytes>. #4250
Add pyo3_ffi::c_str macro to create &'static CStr on Rust versions which don't have 1.77's c"" literals. #4255
Support bool conversion with numpy 2.0's numpy.bool type #4258
Change the type of PySliceIndices::slicelength and the length parameter of PySlice::indices(). #3761
Deprecate implicit default for trailing optional arguments #4078
Cloneing pointers into the Python heap has been moved behind the py-clone feature, as it must panic without the GIL being held as a soundness fix. #4095
Add #[track_caller] to all Py<T>, Bound<'py, T> and Borrowed<'a, 'py, T> methods which can panic. #4098
Change PyAnyMethods::dir to be fallible and return PyResult<Bound<'py, PyList>> (and similar for PyAny::dir). #4100
The global reference pool (to track pending reference count decrements) is now initialized lazily to avoid the overhead of taking a mutex upon function entry when the functionality is not actually used. #4178
Emit error messages when using weakref or dict when compiling for abi3 for Python older than 3.9. #4194
Change PyType::name to always match Python __name__. #4196
Deprecate implicit integer comparision for simple enums in favor of #[pyclass(eq_int)]. #4210
Set the module= attribute of declarative modules' child #[pymodule]s and #[pyclass]es. #4213
Set the module option for complex enum variants from the value set on the complex enum module. #4228
Respect the Python "limited API" when building for the abi3 feature on PyPy or GraalPy. #4237
Optimize code generated by #[pyo3(get)] on #[pyclass] fields. #4254
PyCFunction::new, PyCFunction::new_with_keywords and PyCFunction::new_closure now take &'static CStr name and doc arguments (previously was &'static str). #4255
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 major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Bumps the deps group with 9 updates:
4.5.4
4.5.8
0.4.21
0.4.22
0.21.2
0.22.0
1.0.117
1.0.120
0.8.13
0.8.14
1.10.4
1.10.5
4.5.2
4.5.7
2.2.0
2.2.1
0.12.4
0.12.5
Updates
clap
from 4.5.4 to 4.5.8Release notes
Sourced from clap's releases.
Changelog
Sourced from clap's changelog.
Commits
469d847
chore: Releasee323b91
docs: Update changelog7101c64
Merge pull request #5557 from tesuji/fish-positional-args-files5ee1a25
fix(fish): Don't ignore files if has positional args3a2fb25
Merge pull request #5547 from tesuji/fish-list1e3681b
refactor: Pass list to __fish_seen_subcommand_fromb1a0508
refactor: Rewrite iterator for followup changes5cc44bb
Merge pull request #5548 from tesuji/fish-escape-tab181b9e0
test: Ensure optional_value runs0724b7b
chore: Remove tarpaulin supportUpdates
log
from 0.4.21 to 0.4.22Changelog
Sourced from log's changelog.
Commits
d5ba2cf
Merge pull request #634 from rust-lang/cargo/0.4.22d1a8306
prepare for 0.4.22 release46894ef
Merge pull request #633 from rust-lang/feat/panic-infoe0d389c
Merge pull request #632 from rust-lang/feat/loosen-atomicsc9e5e13
use Location::caller() for file and line info507b672
loosen orderings for logger initializationc879b01
Merge pull request #628 from Thomasdezeeuw/fix-warnings405fdb4
Merge pull request #627 from Thomasdezeeuw/check-features1307ade
Remove unneeded import710560e
Don't use --all-features in CIUpdates
pyo3
from 0.21.2 to 0.22.0Release notes
Sourced from pyo3's releases.
Changelog
Sourced from pyo3's changelog.
... (truncated)
Commits
2e2d440
release: 0.22.0 (#4266)91d8683
improve deprecation message on implicit trailing optionals (#4282)6a0221b
document FnType and refactor FnType::self_arg (#4276)c67625d
Revamp PyType name functions to match PEP 737 (#4196)a2f9399
make datetime from timestamp tests compare against Python result (#4275)908ef6a
Implement PartialEq for PyBytes and [u8] (#4259)c4d18e5
Changesearch_lib_dir
's return type to Result (#4043)0b967d4
useffi::MemberGef
for#[pyo3(get)]
fields ofPy\<T>
(#4254)41fb957
docs: update docstring onPython
forBound
API (#4274)9ff3d23
Update dependencies to reflect minimal versions (#4272)Updates
serde_json
from 1.0.117 to 1.0.120Release notes
Sourced from serde_json's releases.
Commits
bcedc3d
Release 1.0.120962c0fb
Merge pull request #1152 from cforycki/fix/index-map-minimal-version3480fed
fix: indexmap minimal version with Map::shift_insert()b48b9a3
Release 1.0.1198878cd7
Make shift_insert available for inlining like other Map methods352b7ab
Document the cfg required for Map::shift_insert to existc17e63f
Merge pull request #1149 from joshka/master309ef6b
Add Map::shift_insert()a9e089a
Merge pull request #1146 from haouvw/mastera83fe96
chore: remove repeat wordsUpdates
toml
from 0.8.13 to 0.8.14Commits
c383efa
chore: Release7bb1781
docs: Update changelog0af6deb
Merge pull request #740 from epage/key-quotesc9e36e7
fix(encode): Prefer literals over escaping double-quotes42f7a1b
test(encode): Show existing quote behavior9e6290f
chore(deps): Update compatible (dev) (#737)dbf1cc1
Merge pull request #736 from epage/snapboxec9bfd7
chore: Update to snapbox 0.6881bf67
chore: Remove unused featuresb62c76e
refactor: Resolve deprecationsUpdates
regex
from 1.10.4 to 1.10.5Changelog
Sourced from regex's changelog.
Commits
0718fc5
1.10.5377463b
changelog: 1.10.4 and 1.10.568c4f0b
regex-automata-0.4.74757b5f
regex-syntax-0.8.41430b65
changelog: 1.10.41f9f9cc
bytes: escape invalid UTF-8 bytes in debug output for Matchab4c8d1
doc: fix duplicate phrasing typoddeb85e
cli/deps: update memmap2 to 0.9023f1c9
lite: fix attribute warning about rustfmt9c139f4
syntax: simplifyHir::dot
constructorsUpdates
clap_complete
from 4.5.2 to 4.5.7Release notes
Sourced from clap_complete's releases.
Changelog
Sourced from clap_complete's changelog.
Commits
469d847
chore: Releasee323b91
docs: Update changelog7101c64
Merge pull request #5557 from tesuji/fish-positional-args-files5ee1a25
fix(fish): Don't ignore files if has positional args3a2fb25
Merge pull request #5547 from tesuji/fish-list1e3681b
refactor: Pass list to __fish_seen_subcommand_fromb1a0508
refactor: Rewrite iterator for followup changes5cc44bb
Merge pull request #5548 from tesuji/fish-escape-tab181b9e0
test: Ensure optional_value runs0724b7b
chore: Remove tarpaulin supportUpdates
diesel
from 2.2.0 to 2.2.1Changelog
Sourced from diesel's changelog.
Commits
08be4f2
Merge pull request #4071 from weiznich/prepare/2.2.18c47c6f
Bump mysqlclient-sys to 0.496a822a
Prepare a 2.2.1 release1ae7a0a
Merge pull request #4057 from weiznich/fix/40554d5fb4f
Merge pull request #4054 from weiznich/fix/auto_type_lifetimes1062c27
Merge pull request #4063 from sugar700/allow-type-name-conflicting-with-trait...5c870f7
Merge pull request #4067 from weiznich/fix/cli_diff_schema_default_schema48ccc78
Merge pull request #4064 from weiznich/fix/mysqlclient_regression_with_old_ve...f6da5f5
Merge pull request #4065 from weiznich/fix/scramUpdates
reqwest
from 0.12.4 to 0.12.5Release notes
Sourced from reqwest's releases.
Changelog
Sourced from reqwest's changelog.
Commits
29d4cff
v0.12.5a7880d6
tests: fix http3 testsc32d877
tests: enable http3 content-length testce3b30e
http3: send content-length if known404df59
test: add http3 test server supporte5ce0b5
fix: don't enable hyper-rustls/http2 unless http2 is already enabledccb5e40
Don't compile hyper-tls with native-roots unless rustls-tls-native-roots is e...c56fbae
tests: remove a proxy parse error check8cc7cd4
msrv: pin url695bc04
fix: http3 resolving ipv6 addresses (#2305)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