All Versions
67
Latest Version
Avg Release Cycle
36 days
Latest Release
768 days ago

Changelog History
Page 3

  • v0.13.1 Changes

    January 10, 2021

    ➕ Added

    • ➕ Add support for #[pyclass(dict)] and #[pyclass(weakref)] with the abi3 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 and PyGetSetDef_INIT which have never been in the Python API. #1341
    • Deprecate FFI definitions PyGen_NeedsFinalizing, PyImport_Cleanup (removed in 3.9), and PyOS_InitInterrupts (3.10). #1348
    • 🗄 Deprecate FFI definition PyOS_AfterFork for Python 3.7 and up. #1348
    • Deprecate FFI definitions PyCoro_Check, PyAsyncGen_Check, and PyCoroWrapper_Check, which have never been in the Python API (for the first two, it is possible to use PyCoro_CheckExact and PyAsyncGen_CheckExact instead; these are the actual functions provided by the Python API). #1348
    • Deprecate FFI definitions for PyUnicode_FromUnicode, PyUnicode_AsUnicode and PyUnicode_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 and PyImport_Cleanup (for 3.9 and up), and PyOS_InitInterrupts (3.10). #1348

    🛠 Fixed

    • Stop including Py_TRACE_REFS config setting automatically if Py_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
  • v0.13.0 Changes

    December 22, 2020

    Packaging

    • ⬇️ 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 and pyo3-derive-backend to pyo3-macros and pyo3-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 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 and PyEval_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 and PyString. #1282
    • Add FFI definitions for PyBuffer_SizeFromFormat, PyObject_LengthHint, PyObject_CallNoArgs, PyObject_CallOneArg, PyObject_CallMethodNoArgs, PyObject_CallMethodOneArg, PyObject_VectorcallDict, and PyObject_VectorcallMethod. #1287
    • ➕ Add conversions between u128/i128 and PyLong for PyPy. #1310
    • ➕ Add Python::version() and Python::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() from Cow<str> to PyResult<&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 of PyIterator<'a>. #1176
    • 🔄 Change formatting of PyDowncastError messages to be closer to Python's builtin error messages. #1212
    • 🔄 Change Debug and Display impls for PyException to be consistent with PyAny. #1275
    • 🔄 Change Debug impl of PyErr to output more helpful information (acquiring the GIL if necessary). #1275
    • Rename PyTypeInfo::is_instance and PyTypeInfo::is_exact_instance to PyTypeInfo::is_type_of and PyTypeInfo::is_exact_type_of. #1278
    • Optimize PyAny::call0, Py::call0 and PyAny::call_method0 and Py::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, and Python::xdecref. #1292

    ✂ Removed

    • Remove deprecated ffi definitions PyUnicode_AsUnicodeCopy, PyUnicode_GetMax, _Py_CheckRecursionLimit, PyObject_AsCharBuffer, PyObject_AsReadBuffer, PyObject_CheckReadBuffer and PyObject_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 from x86_64-unknown-linux-gnu host. #1267
    • Fix #[text_signature] interacting badly with rust r#raw_identifiers. #1286
    • Fix FFI definitions for PyObject_Vectorcall and PyVectorcall_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 of From<Py<T>> for PyObject. 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 the 0.12 series will be yanked.

    Sincerest apologies for the inconvenience.

    🛠 Fixed

    • 🛠 Fix reference count bug in implementation of From<Py<T>> for PyObject, a regression introduced in PyO3 0.12. #1297
  • 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

    ➕ Added

    • ➕ Add support for keyword-only arguments without default values in #[pyfunction]. #1209
    • 🚦 Add Python::check_signals() as a safe a wrapper for PyErr_CheckSignals(). #1214

    🛠 Fixed

    • 🛠 Fix invalid document for protocol methods. #1169
    • 📄 Hide docs of PyO3 private implementation details in pyo3::class::methods. #1169
    • 🛠 Fix unnecessary rebuild on PATH changes when the python interpreter is provided by PYO3_PYTHON. #1231
  • 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

    • 🛠 Fix building for a 32-bit Python on 64-bit Windows with a 64-bit Rust toolchain. #1179
    • 🛠 Fix building on platforms where c_char is u8. #1182
  • v0.12.0 Changes

    September 12, 2020

    ➕ Added

    • Add FFI definitions Py_FinalizeEx, PyOS_getsig, and PyOS_setsig. #1021
    • ➕ Add PyString::to_str for accessing PyString 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 for PyIterator. #1051
    • Add PyBytes::new_with and PyByteArray::new_with for initialising bytes and bytearray objects using a closure. #1074
    • ➕ Add #[derive(FromPyObject)] macro for enums and structs. #1065
    • Add Py::as_ref and Py::into_ref for converting Py<T> to &T. #1098
    • ➕ Add ability to return Result types other than PyResult from #[pyfunction], #[pymethod] and #[pyproto] functions. #1106.
    • Implement ToPyObject, IntoPy, and FromPyObject for hashbrown's HashMap and HashSet types (requires the hashbrown 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 and PyModule::add_submodule as typed alternatives to PyModule::add_wrapped. #1143
    • ➕ Add native PyCFunction and PyFunction types. #1163

    🔄 Changed

    • 👻 Rework exception types: #1024 #1115
      • Rename exception types from e.g. RuntimeError to PyRuntimeError. The old names continue to exist but are deprecated.
      • Exception objects are now accessible as &T or Py<T>, just like other Python-native types.
      • Rename PyException::py_err() to PyException::new_err().
      • Rename PyUnicodeDecodeErr::new_err() to PyUnicodeDecodeErr::new().
      • Remove PyStopIteration::stop_iteration().
    • Require T: Send for the return value T of Python::allow_threads. #1036
    • Rename PYTHON_SYS_EXECUTABLE to PYO3_PYTHON. The old name will continue to work (undocumented) but will be removed in a future release. #1039
    • Remove unsafe from signature of PyType::as_type_ptr. #1047
    • 🔄 Change return type of PyIterator::from_object to PyResult<PyIterator> (was Result<PyIterator, PyDowncastError>). #1051
    • IntoPy is no longer implied by FromPy. #1063
    • 🔄 Change PyObject to be a type alias for Py<PyAny>. #1063
    • Rework PyErr to be compatible with the std::error::Error trait: #1067 #1115
      • Implement Display, Error, Send and Sync for PyErr and PyErrArguments.
      • Add PyErr::instance() for accessing PyErr as &PyBaseException.
      • PyErr's fields are now an implementation detail. The equivalent values can be accessed with PyErr::ptype(), PyErr::pvalue() and PyErr::ptraceback().
      • Change receiver of PyErr::print() and PyErr::print_and_set_sys_last_vars() to &self (was self).
      • Remove PyErrValue, PyErr::from_value, PyErr::into_normalized(), and PyErr::normalize().
      • Remove PyException::into().
      • Remove Into<PyResult<T>> for PyErr and PyException.
    • 🔄 Change methods generated by #[pyproto] to return NotImplemented if Python should try a reversed operation. #1072
    • 🔄 Change argument to PyModule::add to impl IntoPy<PyObject> (was impl ToPyObject). #1124

    ✂ Removed

    • ✂ Remove many exception and PyErr APIs; see the "changed" section above. #1024 #1067 #1115
    • Remove PyString::to_string (use new PyString::to_str). #1023
    • ✂ Remove PyString::as_bytes. #1023
    • ✂ Remove Python::register_any. #1023
    • Remove GILGuard::acquire from the public API. Use Python::acquire_gil or Python::with_gil. #1036
    • ✂ Remove the FromPy trait. #1063
    • ✂ Remove the AsPyRef trait. #1098

    🛠 Fixed

    • Correct FFI definitions Py_SetProgramName and Py_SetPythonHome to take *const arguments (was *mut). #1021
    • Fix FromPyObject for num_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 in PyNumberProtocol (and similar for all other reversible operators). #1107
    • 🛠 Fix building with Anaconda python. #1175
  • v0.11.1 Changes

    June 30, 2020

    #[pyclass(unsendable)] is added, please check the guide!

    [0.11.1] - 2020-06-30

    ➕ Added

    • #[pyclass(unsendable)]. #1009

    🔄 Changed

    • ⚡️ Update parking_lot dependency to 0.11. #1010
  • 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] requires Send. 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, and PyByteArray::as_bytes_mut. #967
    • Add GILOnceCell to use in situations where lazy_static or once_cell can deadlock. #975
    • Add Py::borrow, Py::borrow_mut, Py::try_borrow, and Py::try_borrow_mut for accessing #[pyclass] values. #976
    • Add IterNextOutput and IterANextOutput for returning from __next__ / __anext__. #997

    🔄 Changed

    • 🚚 Simplify internals of #[pyo3(get)] attribute. (Remove the hidden API GetPropertyValue.) #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 on PyObject and Py<T> to ensure GIL safety. #970
    • 🔄 Change signature of PyTypeObject::type_object() - now takes Python argument and returns &PyType. #970
    • 🔄 Change return type of PyTuple::slice() and PyTuple::split_from() from Py<PyTuple> to &PyTuple. #970
    • 🔄 Change return type of PyTuple::as_slice to &[&PyAny]. #971
    • Rename PyTypeInfo::type_object to type_object_raw, and add Python argument. #975
    • ⚡️ Update num-complex optional dependendency from 0.2 to 0.3. #977
    • ⚡️ Update num-bigint optional dependendency from 0.2 to 0.3. #978
    • #[pyproto] is re-implemented without specialization. #961
    • PyClassAlloc::alloc is renamed to PyClassAlloc::new. #990
    • 👍 #[pyproto] methods can now have return value T or PyResult<T> (previously only PyResult<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 to Option<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> and PyRefMut<Self> to #[getter] and #[setter] methods. #999
  • v0.10.1 Changes

    May 14, 2020

    0.10.0 has a deadlock bug and was yanked. Thank you @davidhewitt for fixing it!

    🛠 Fixed

    • 🛠 Fix deadlock in Python::acquire_gil() after dropping a PyObject or Py<T>. #924