Releases: PyO3/pyo3
PyO3 0.19.0
This release completes the implementation of automatically generated __text_signature__
for #[pymethods]
and #[pyfunctions]
by extending support for #[new]
functions as well as rendering the value of simple default values such as integers, bools, and None
in the generated signature.
Support for rust_decimal
conversions to Python's decimal.Decimal
has been added.
Usage of #[pyclass(frozen)]
types becomes more powerful with the addition of Py::get
to access contents of frozen classes without needing the Python GIL.
Some important fixes and removals have landed:
__traverse__
implementations may no longer access Python APIs or acquire the Python GIL. Attempting to usePython::with_gil
will panic.#[pyclass(unsendable)]
types will now warn and skipDrop
implementations when dropped on a thread other than the one the type was created on.- The deprecated
Python::acquire_gil
has been removed.
There have been numerous other smaller improvements, changes and fixes. For full details see the CHANGELOG.
Please consult the migration guide for help upgrading.
Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following users' commits are included in this release:
@adamreichold
@AdilZouitine
@adriangb
@alex
@AntoineRR
@BlueGlassBlock
@cardoe
@cfour2
@davidhewitt
@decathorpe
@Enyium
@est31
@iajoiner
@ijl
@jond01
@kngwyu
@lifthrasiir
@lycantropos
@mattip
@mejrs
@messense
@OliverBalfour
@samuelcolvin
@sollyucko
@stuhood
@suyanhanx
@Walnut356
@why-not-try-calmer
@willstott101
@wjones127
@xcharleslin
PyO3 0.18.3
This release fixes an issue with PyDateTime::type_object()
incorrectly returning the type object for PyDate
, which would cause some is_instance
checks to behave incorrectly.
In addition, this release contains a handful of minor quality-of-life corrections over PyO3 0.18.2.
Thank you to the following users for the improvements:
@adamreichold
@davidhewitt
@decathorpe
@ijl
@mejrs
@messense
@sollyucko
@willstott101
@wjones127
PyO3 0.18.2
This release fixes a rare ref-counting race condition when a PyObject
is cloned inside of closure passed to Python::allow_threads
. It is advised to update to this release if possible.
Conversions for Cell<T>
and Cow<[u8]>
have been added, as well as PyList::to_tuple
and PyTuple::to_list
as the most efficient way to convert between those types.
This release also contains some other minor performance optimisations and bugfixes.
Thank you to the following users for the improvements:
@adamreichold
@AdilZouitine
@adriangb
@AntoineRR
@davidhewitt
@Enyium
@iajoiner
@kngwyu
@lycantropos
@mattip
@mejrs
@messense
@OliverBalfour
@samuelcolvin
PyO3 0.18.1
This release fixes several bugs identified since PyO3 0.18.0, including a segfault and a Windows-specific issue with the PyIterator
type, which would incorrectly accept any Python class regardless of whether it defined __next__
or not.
Some new APIs have been added such as PyErr::write_unraisable()
, PyAny::is_ellipsis()
and PyDict::update
.
Thank you to the following users for the improvements:
@adamreichold
@alexpyattaev
@davidhewitt
@jjerphan
@jmhodges
@mejrs
@messense
@mitsuhiko
@neachdainn
@qbx2
@samuelcolvin
PyO3 0.18.0
This release contains a number of new features for PyO3's macros which should make maintaining PyO3 projects easier.
#[pyfunction]
and #[pymethods]
have a new #[pyo3(signature = (...))]
option which allows specifying the Python signature. This replaces the #[args]
option already present for #[pymethods]
; the new option is better-validated and offers a syntax much more intuitive to users familiar with writing pure-Python functions.
#[pyclass]
has new get_all
and set_all
options for cases where all fields of a type should be readable or writable from Python.
The #[pyo3(text_signature = "...")]
option is now autogenerated for all functions created with #[pyfunction]
and #[pymethods]
. It can still be applied manually when it is necessary to override the generated form.
As well as the macro API improvements, some other notable changes include:
PySet::new
andPyFrozenSet::new
now accept Rust iterators rather than requiring a slice.- Rust types have been added for all Python's built-in
Warning
types. - Non-zero integer types in
std::num
now have a conversion to/from Pythonint
. - The deprecated
#[pyproto]
attribute is now removed.
There have been numerous other smaller improvements, changes and fixes. For full details see the CHANGELOG.
Please consult the migration guide for help upgrading.
Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following users' commits are included in this release:
@a1phyr
@adamreichold
@AdilZouitine
@alex
@birkenfeld
@CLOVIS-AI
@ctb
@dalcde
@datapythonista
@davidhewitt
@dylanbstorey
@flickpp
@gnaaman-dn
@haixuanTao
@hauntsaninja
@ijl
@itamarst
@jqnatividad
@matthewlloyd
@mejrs
@messense
@mrob95
@ongchi
@Oppen
@prehner
@Psykopear
@qbx2
@ryanrussell
@saethlin
@santokalayil
@saulshanabrook
@smheidrich
@SquidDev
PyO3 0.17.3
This release confirms support for Python 3.11 in PyO3.
(Previous versions of PyO3 0.17 had been tested against release candidates of Python 3.11 and no Python 3.11 fixes have been added since 0.17.0, so all PyO3 0.17 versions should in practice be fine to use with Python 3.11.)
In addition, some other small additions and fixes have been added on top of PyO3 0.17.2.
Thank you to the following users for the improvements:
@adamreichold
@ctb
@datapythonista
@davidhewitt
@messense
@saethlin
PyO3 0.17.2
This release contains non-breaking improvements and bugfixes over PyO3 0.17.1.
A new chrono
feature has been added to support converting from types in chrono
to types in the Python datetime
module. The num-bigint
feature has been expanded to add support to PyPy.
There has also been fixes for a couple of regressions observed in PyO3 0.17.
Thank you to the following users for the improvements:
@adamreichold
@AdilZouitine
@davidhewitt
@messense
@mrob95
@Oppen
@prehner
@Psykopear
@ryanrussell
@smheidrich
@SquidDev
PyO3 0.17.1
This release contains some minor bug fixes for PyO3 0.17.0. In particular the new PyDictItems
, PyDictKeys
and PyDictValues
types are actually accessible!
Thanks to @davidhewitt, @messense and @PrettyWood for the fixes.
PyO3 0.17.0
This release contains a focus on quality improvements over the PyO3 0.16 releases.
There have been new API types added such as PyDictKeys
, PyDictValues
, PyDictItems
, PyCode
, PyFrame
, and PySuper
. The PyMapping
and PySequence
types have changed so they are more directly compatible with the corresponding Python Mapping
and Sequence
base classes in the collections.abc
module (this is a breaking change).
A new #[pyclass(frozen)]
option has been added to opt-out of runtime borrow checking by removing the ability to access &mut self
for objects owned by Python.
There have been a number of soundness fixes, both to the PyCapsule
type (see the CHANGELOG for more details) and to a number of FFI bindings which had fallen out of sync with newer Python and PyPy releases.
There have been numerous other smaller improvements, changes and fixes. For full details see the CHANGELOG.
Please consult the migration guide for help upgrading.
Thank you to everyone who contributed code, documentation, design ideas, bug reports, and feedback. The following users' commits are included in this release:
@acshi
@aganders3
@alex
@birkenfeld
@cjermain
@Cryptex-github
@cuishuang
@davidhewitt
@drewkett
@dswij
@herquan
@hoodmane
@ikrivosheev
@indygreg
@jeertmans
@jinlow
@jonaspleyer
@kngwyu
@mejrs
@messense
@n8henrie
@PigeonF
@PWhiddy
@ravenexp
@savente93
@yankun1992
@yodaldevoid
PyO3 0.16.6
This release is a tactical set of soundness fixes identified for the PyCapsule
bindings released in PyO3 0.16. To avoid breaking API changes capsules created with PyCapsule::new
and PyCapsule::new_with_destructor
will now leak their contents (and not call the destructor) if released on a thread other than the one they were created.
PyO3 0.17 will be released shortly with breaking API changes which resolve the PyCapsule
issues with better design (e.g. the destructor
has a Send
bound added). Users are encouraged to upgrade at their earliest convenience.
Thanks to @saethlin for reporting the issue, and to @adamreichold and @davidhewitt for implementing the resolution.