Changelog History
Page 3
-
v0.13.1 Changes
January 10, 2021➕ Added
- ➕ Add support for
#[pyclass(dict)]
and#[pyclass(weakref)]
with theabi3
feature on Python 3.9 and up. #1342 - Add FFI definitions
PyOS_BeforeFork
,PyOS_AfterFork_Parent
,PyOS_AfterFork_Child
for Python 3.7 and up. #1348 - ➕ Add an
auto-initialize
feature to control whether PyO3 should automatically initialize an embedded Python interpreter. For compatibility this feature is enabled by default in PyO3 0.13.1, but is planned to become opt-in from PyO3 0.14.0. #1347 - Add support for cross-compiling to Windows without needing
PYO3_CROSS_INCLUDE_DIR
. #1350
🗄 Deprecated
- Deprecate FFI definitions
PyEval_CallObjectWithKeywords
,PyEval_CallObject
,PyEval_CallFunction
,PyEval_CallMethod
when building for Python 3.9. #1338 - Deprecate FFI definitions
PyGetSetDef_DICT
andPyGetSetDef_INIT
which have never been in the Python API. #1341 - Deprecate FFI definitions
PyGen_NeedsFinalizing
,PyImport_Cleanup
(removed in 3.9), andPyOS_InitInterrupts
(3.10). #1348 - 🗄 Deprecate FFI definition
PyOS_AfterFork
for Python 3.7 and up. #1348 - Deprecate FFI definitions
PyCoro_Check
,PyAsyncGen_Check
, andPyCoroWrapper_Check
, which have never been in the Python API (for the first two, it is possible to usePyCoro_CheckExact
andPyAsyncGen_CheckExact
instead; these are the actual functions provided by the Python API). #1348 - Deprecate FFI definitions for
PyUnicode_FromUnicode
,PyUnicode_AsUnicode
andPyUnicode_AsUnicodeAndSize
, which will be removed from 3.12 and up due to PEP 613. #1370
✂ Removed
- ✂ Remove FFI definition
PyFrame_ClearFreeList
when building for Python 3.9. #1341 - Remove FFI definition
_PyDict_Contains
when building for Python 3.10. #1341 - Remove FFI definitions
PyGen_NeedsFinalizing
andPyImport_Cleanup
(for 3.9 and up), andPyOS_InitInterrupts
(3.10). #1348
🛠 Fixed
- Stop including
Py_TRACE_REFS
config setting automatically ifPy_DEBUG
is set on Python 3.8 and up. #1334 - ✂ Remove
#[deny(warnings)]
attribute (and instead refuse warnings only in CI). #1340 - Fix deprecation warning for missing
__module__
with#[pyclass]
. #1343 - Correct return type of
PyFrozenSet::empty
to&PyFrozenSet
(was incorrectly&PySet
). #1351 - 🛠 Fix missing
Py_INCREF
on heap type objects on Python versions before 3.8. #1365
- ➕ Add support for
-
v0.13.0 Changes
December 22, 2020Packaging
- ⬇️ Drop support for Python 3.5 (as it is now end-of-life). #1250
- ⬆️ Bump minimum supported Rust version to 1.45. #1272
- ⬆️ Bump indoc dependency to 1.0. #1272
- ⬆️ Bump paste dependency to 1.0. #1272
- 📇 Rename internal crates
pyo3cls
andpyo3-derive-backend
topyo3-macros
andpyo3-macros-backend
respectively. #1317
➕ Added
- ➕ Add support for building for CPython limited API. Opting-in to the limited API enables a single extension wheel built with PyO3 to be installable on multiple Python versions. This required a few minor changes to runtime behaviour of of PyO3
#[pyclass]
types. See the migration guide for full details. #1152- Add feature flags
abi3-py36
,abi3-py37
,abi3-py38
etc. to set the minimum Python version when using the limited API. #1263
- Add feature flags
- ➕ Add argument names to
TypeError
messages generated by pymethod wrappers. #1212 - ➕ Add FFI definitions for PEP 587 "Python Initialization Configuration". #1247
- Add FFI definitions for
PyEval_SetProfile
andPyEval_SetTrace
. #1255 - ➕ Add FFI definitions for context.h functions (
PyContext_New
, etc). #1259 - ➕ Add
PyAny::is_instance()
method. #1276 - ➕ Add support for conversion between
char
andPyString
. #1282 - Add FFI definitions for
PyBuffer_SizeFromFormat
,PyObject_LengthHint
,PyObject_CallNoArgs
,PyObject_CallOneArg
,PyObject_CallMethodNoArgs
,PyObject_CallMethodOneArg
,PyObject_VectorcallDict
, andPyObject_VectorcallMethod
. #1287 - ➕ Add conversions between
u128
/i128
andPyLong
for PyPy. #1310 - ➕ Add
Python::version()
andPython::version_info()
to get the running interpreter version. #1322 - ➕ Add conversions for tuples of length 10, 11, and 12. #1454
🔄 Changed
- 🔄 Change return type of
PyType::name()
fromCow<str>
toPyResult<&str>
. #1152 #[pyclass(subclass)]
is now required for subclassing from Rust (was previously just required for subclassing from Python). #1152- 🔄 Change
PyIterator
to be consistent with other native types: it is now used as&PyIterator
instead ofPyIterator<'a>
. #1176 - 🔄 Change formatting of
PyDowncastError
messages to be closer to Python's builtin error messages. #1212 - 🔄 Change
Debug
andDisplay
impls forPyException
to be consistent withPyAny
. #1275 - 🔄 Change
Debug
impl ofPyErr
to output more helpful information (acquiring the GIL if necessary). #1275 - Rename
PyTypeInfo::is_instance
andPyTypeInfo::is_exact_instance
toPyTypeInfo::is_type_of
andPyTypeInfo::is_exact_type_of
. #1278 - Optimize
PyAny::call0
,Py::call0
andPyAny::call_method0
andPy::call_method0
on Python 3.9 and up. #1287 - Require double-quotes for pyclass name argument e.g
#[pyclass(name = "MyClass")]
. #1303
🗄 Deprecated
- Deprecate
Python::is_instance
,Python::is_subclass
,Python::release
, andPython::xdecref
. #1292
✂ Removed
- Remove deprecated ffi definitions
PyUnicode_AsUnicodeCopy
,PyUnicode_GetMax
,_Py_CheckRecursionLimit
,PyObject_AsCharBuffer
,PyObject_AsReadBuffer
,PyObject_CheckReadBuffer
andPyObject_AsWriteBuffer
, which will be removed in Python 3.10. #1217 - ✂ Remove unused
python3
feature. #1235
🛠 Fixed
- 🛠 Fix missing field in
PyCodeObject
struct (co_posonlyargcount
) - caused invalid access to other fields in Python >3.7. #1260 - 🐧 Fix building for
x86_64-unknown-linux-musl
target fromx86_64-unknown-linux-gnu
host. #1267 - Fix
#[text_signature]
interacting badly with rustr#raw_identifiers
. #1286 - Fix FFI definitions for
PyObject_Vectorcall
andPyVectorcall_Call
. #1287 - 🛠 Fix building with Anaconda python inside a virtualenv. #1290
- 🛠 Fix definition of opaque FFI types. #1312
- 🛠 Fix using custom error type in pyclass
#[new]
methods. #1319
-
v0.12.4 Changes
November 28, 2020🚀 This release fixes a reference count issue discovered in PyO3
0.12.3
, present in the implementation ofFrom<Py<T>>
forPyObject
. Usage of this implementation would lead to an incorrect Python reference count decrease, likely leading to use-after-free.This regression was only present in the PyO3
0.12
series. The offending implementation was used only in one location inside the PyO3 codebase itself, though of course is likely used in downstream code. As a result, previous PyO3 versions in the0.12
series will be yanked.Sincerest apologies for the inconvenience.
🛠 Fixed
- 🛠 Fix reference count bug in implementation of
From<Py<T>>
forPyObject
, a regression introduced in PyO3 0.12. #1297
- 🛠 Fix reference count bug in implementation of
-
v0.12.3 Changes
October 12, 2020🚀 This release fixes support for Rust versions 1.39 through Rust 1.44, which was erroneously broken in PyO3 0.12.2. Thanks to @mtreinish for the quick bug report!
-
v0.12.2 Changes
October 12, 2020 -
v0.12.1 Changes
September 16, 2020🛠 This release contains a couple of bugfixes to resolve complation issues with 0.12.0 on specific targets. Thank you to @alex and @mtreinish for the bug reports and subsequent patches.
🛠 Fixed
-
v0.12.0 Changes
September 12, 2020➕ Added
- Add FFI definitions
Py_FinalizeEx
,PyOS_getsig
, andPyOS_setsig
. #1021 - ➕ Add
PyString::to_str
for accessingPyString
as&str
. #1023 - ➕ Add
Python::with_gil
for executing a closure with the Python GIL. #1037 - ➕ Add type information to failures in
PyAny::downcast()
. #1050 - Implement
Debug
forPyIterator
. #1051 - Add
PyBytes::new_with
andPyByteArray::new_with
for initialisingbytes
andbytearray
objects using a closure. #1074 - ➕ Add
#[derive(FromPyObject)]
macro for enums and structs. #1065 - Add
Py::as_ref
andPy::into_ref
for convertingPy<T>
to&T
. #1098 - ➕ Add ability to return
Result
types other thanPyResult
from#[pyfunction]
,#[pymethod]
and#[pyproto]
functions. #1106. - Implement
ToPyObject
,IntoPy
, andFromPyObject
for hashbrown'sHashMap
andHashSet
types (requires thehashbrown
feature). #1114 - Add
#[pyfunction(pass_module)]
and#[pyfn(pass_module)]
to pass the module object as the first function argument. #1143 - Add
PyModule::add_function
andPyModule::add_submodule
as typed alternatives toPyModule::add_wrapped
. #1143 - ➕ Add native
PyCFunction
andPyFunction
types. #1163
🔄 Changed
- 👻 Rework exception types: #1024 #1115
- Rename exception types from e.g.
RuntimeError
toPyRuntimeError
. The old names continue to exist but are deprecated. - Exception objects are now accessible as
&T
orPy<T>
, just like other Python-native types. - Rename
PyException::py_err()
toPyException::new_err()
. - Rename
PyUnicodeDecodeErr::new_err()
toPyUnicodeDecodeErr::new()
. - Remove
PyStopIteration::stop_iteration()
.
- Rename exception types from e.g.
- Require
T: Send
for the return valueT
ofPython::allow_threads
. #1036 - Rename
PYTHON_SYS_EXECUTABLE
toPYO3_PYTHON
. The old name will continue to work (undocumented) but will be removed in a future release. #1039 - Remove
unsafe
from signature ofPyType::as_type_ptr
. #1047 - 🔄 Change return type of
PyIterator::from_object
toPyResult<PyIterator>
(wasResult<PyIterator, PyDowncastError>
). #1051 IntoPy
is no longer implied byFromPy
. #1063- 🔄 Change
PyObject
to be a type alias forPy<PyAny>
. #1063 - Rework
PyErr
to be compatible with thestd::error::Error
trait: #1067 #1115- Implement
Display
,Error
,Send
andSync
forPyErr
andPyErrArguments
. - Add
PyErr::instance()
for accessingPyErr
as&PyBaseException
. PyErr
's fields are now an implementation detail. The equivalent values can be accessed withPyErr::ptype()
,PyErr::pvalue()
andPyErr::ptraceback()
.- Change receiver of
PyErr::print()
andPyErr::print_and_set_sys_last_vars()
to&self
(wasself
). - Remove
PyErrValue
,PyErr::from_value
,PyErr::into_normalized()
, andPyErr::normalize()
. - Remove
PyException::into()
. - Remove
Into<PyResult<T>>
forPyErr
andPyException
.
- Implement
- 🔄 Change methods generated by
#[pyproto]
to returnNotImplemented
if Python should try a reversed operation. #1072 - 🔄 Change argument to
PyModule::add
toimpl IntoPy<PyObject>
(wasimpl ToPyObject
). #1124
✂ Removed
- ✂ Remove many exception and
PyErr
APIs; see the "changed" section above. #1024 #1067 #1115 - Remove
PyString::to_string
(use newPyString::to_str
). #1023 - ✂ Remove
PyString::as_bytes
. #1023 - ✂ Remove
Python::register_any
. #1023 - Remove
GILGuard::acquire
from the public API. UsePython::acquire_gil
orPython::with_gil
. #1036 - ✂ Remove the
FromPy
trait. #1063 - ✂ Remove the
AsPyRef
trait. #1098
🛠 Fixed
- Correct FFI definitions
Py_SetProgramName
andPy_SetPythonHome
to take*const
arguments (was*mut
). #1021 - Fix
FromPyObject
fornum_bigint::BigInt
for Python objects with an__index__
method. #1027 - Correct FFI definition
_PyLong_AsByteArray
to take*mut c_uchar
argument (was*const c_uchar
). #1029 - 🛠 Fix segfault with
#[pyclass(dict, unsendable)]
. #1058 #1059 - 🛠 Fix using
&Self
as an argument type for functions in a#[pymethods]
block. #1071 - 🛠 Fix best-effort build against PyPy 3.6. #1092
- 🛠 Fix many cases of lifetime elision in
#[pyproto]
implementations. #1093 - 🛠 Fix detection of Python build configuration when cross-compiling. #1095
- Always link against libpython on android with the
extension-module
feature. #1095 - Fix the
+
operator not trying__radd__
when both__add__
and__radd__
are defined inPyNumberProtocol
(and similar for all other reversible operators). #1107 - 🛠 Fix building with Anaconda python. #1175
- Add FFI definitions
-
v0.11.1 Changes
June 30, 2020 -
v0.11.0 Changes
June 28, 2020👍 This is our first version that supports the stable Rust toolchain. The minimum required version is 1.39.0.
Thank you @davidhewitt @scalexm @tamuhey @konstin @Nateckert@Alexander-N @m-ou-se and all issue reporters 🙂👀 Maybe the most influential change is now
#[pyclass]
requiresSend
. Please see the migration guide for more.➕ Added
- 👌 Support stable versions of Rust (>=1.39). #969
- ➕ Add FFI definition
PyObject_AsFileDescriptor
. #938 - Add
PyByteArray::data
,PyByteArray::as_bytes
, andPyByteArray::as_bytes_mut
. #967 - Add
GILOnceCell
to use in situations wherelazy_static
oronce_cell
can deadlock. #975 - Add
Py::borrow
,Py::borrow_mut
,Py::try_borrow
, andPy::try_borrow_mut
for accessing#[pyclass]
values. #976 - Add
IterNextOutput
andIterANextOutput
for returning from__next__
/__anext__
. #997
🔄 Changed
- 🚚 Simplify internals of
#[pyo3(get)]
attribute. (Remove the hidden APIGetPropertyValue
.) #934 - Call
Py_Finalize
at exit to flush buffers, etc. #943 - ➕ Add type parameter to PyBuffer. #951
- Require
Send
bound for#[pyclass]
. #966 - ➕ Add
Python
argument to most methods onPyObject
andPy<T>
to ensure GIL safety. #970 - 🔄 Change signature of
PyTypeObject::type_object()
- now takesPython
argument and returns&PyType
. #970 - 🔄 Change return type of
PyTuple::slice()
andPyTuple::split_from()
fromPy<PyTuple>
to&PyTuple
. #970 - 🔄 Change return type of
PyTuple::as_slice
to&[&PyAny]
. #971 - Rename
PyTypeInfo::type_object
totype_object_raw
, and addPython
argument. #975 - ⚡️ Update
num-complex
optional dependendency from0.2
to0.3
. #977 - ⚡️ Update
num-bigint
optional dependendency from0.2
to0.3
. #978 #[pyproto]
is re-implemented without specialization. #961PyClassAlloc::alloc
is renamed toPyClassAlloc::new
. #990- 👍
#[pyproto]
methods can now have return valueT
orPyResult<T>
(previously onlyPyResult<T>
was supported). #996 #[pyproto]
methods can now skip annotating the return type if it is()
. #998
✂ Removed
- ✂ Remove
ManagedPyRef
(unused, and needs specialization) #930
🛠 Fixed
- 🛠 Fix passing explicit
None
toOption<T>
argument#[pyfunction]
with a default value. #936 - 🆕 Fix
PyClass. __new__
's not respecting subclasses when inherited by a Python class. #990 - 🛠 Fix returning
Option<T>
from#[pyproto]
methods. #996 - 🛠 Fix accepting
PyRef<Self>
andPyRefMut<Self>
to#[getter]
and#[setter]
methods. #999
-
v0.10.1 Changes
May 14, 20200.10.0 has a deadlock bug and was yanked. Thank you @davidhewitt for fixing it!
🛠 Fixed
- 🛠 Fix deadlock in
Python::acquire_gil()
after dropping aPyObject
orPy<T>
. #924
- 🛠 Fix deadlock in