PyO3 v0.13.0 Release Notes

Release Date: 2020-12-22 // over 3 years ago
  • 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