PyO3 v0.14.0 Release Notes
Release Date: 2021-07-03 // almost 3 years ago-
Packaging
- ⚡️ Update
num-bigint
optional dependency to 0.4. #1481 - ⚡️ Update
num-complex
optional dependency to 0.4. #1482 - 👍 Extend
hashbrown
optional dependency supported versions to include 0.11. #1496 - 👌 Support PyPy 3.7. #1538
➕ Added
- Extend conversions for
[T; N]
to allN
using const generics (on Rust 1.51 and up). #1128 - ➕ Add conversions between
OsStr
/OsString
and Python strings. #1379 - ➕ Add conversions between
Path
/PathBuf
and Python strings (andpathlib.Path
objects). #1379 #1654 - ➕ Add a new set of
#[pyo3(...)]
attributes to control various PyO3 macro functionality: - ➕ Add FFI definition
PyCFunction_CheckExact
for Python 3.9 and later. #1425 - Add FFI definition
Py_IS_TYPE
. #1429 - Add FFI definition
_Py_InitializeMain
. #1473 - ➕ Add FFI definitions from
cpython/import.h
.#1475 - ➕ Add tuple and unit struct support for
#[pyclass]
macro. #1504 - Add FFI definition
PyDateTime_TimeZone_UTC
. #1572 - ➕ Add support for
#[pyclass(extends=Exception)]
. #1591 - ➕ Add
PyErr::cause
andPyErr::set_cause
. #1679 - ➕ Add FFI definitions from
cpython/pystate.h
. #1687 - ➕ Add
wrap_pyfunction!
macro topyo3::prelude
. #1695
🔄 Changed
- 👍 Allow only one
#[pymethods]
block per#[pyclass]
by default, to remove the dependency oninventory
. Add amultiple-pymethods
feature to opt-in the original behavior and dependency oninventory
. #1457 - 🔄 Change
PyTimeAccess::get_fold
to return abool
instead of au8
. #1397 - 🗄 Deprecate FFI definition
PyCFunction_Call
for Python 3.9 and up. #1425 - 🗄 Deprecate FFI definition
PyModule_GetFilename
. #1425 - 0️⃣ The
auto-initialize
feature is no longer enabled by default. #1443 - Change
PyCFunction::new()
andPyCFunction::new_with_keywords()
to take&'static str
arguments rather than implicitly copying (and leaking) them. #1450 - 🗄 Deprecate
PyModule::call
,PyModule::call0
,PyModule::call1
andPyModule::get
. #1492 - Add length information to
PyBufferError
s raised fromPyBuffer::copy_to_slice
andPyBuffer::copy_from_slice
. #1534 - 🍎 Automatically set
-undefined
anddynamic_lookup
linker arguments on macOS with theextension-module
feature. #1539 - 🗄 Deprecate
#[pyproto]
methods which are easier to implement as#[pymethods]
: #1560PyBasicProtocol::__bytes__
andPyBasicProtocol::__format__
PyContextProtocol::__enter__
andPyContextProtocol::__exit__
PyDescrProtocol::__delete__
andPyDescrProtocol::__set_name__
PyMappingProtocol::__reversed__
PyNumberProtocol::__complex__
andPyNumberProtocol::__round__
PyAsyncProtocol::__aenter__
andPyAsyncProtocol::__aexit__
- 🗄 Deprecate several attributes in favor of the new
#[pyo3(...)]
options: - ⬇️ Reduce LLVM line counts to improve compilation times. #1604
- No longer call
PyEval_InitThreads
in#[pymodule]
init code. #1630 - 🐎 Use
METH_FASTCALL
argument passing convention, when possible, to improve#[pyfunction]
and method performance. #1619, #1660 - Filter sysconfigdata candidates by architecture when cross-compiling. #1626
✂ Removed
- ✂ Remove deprecated exception names
BaseException
etc. #1426 - Remove deprecated methods
Python::is_instance
,Python::is_subclass
,Python::release
,Python::xdecref
, andPy::from_owned_ptr_or_panic
. #1426 - ✂ Remove many FFI definitions which never existed in the Python C-API:
- ✂ Remove pyclass implementation details from
PyTypeInfo
: - Remove
PYO3_CROSS_INCLUDE_DIR
environment variable and the associated C header parsing functionality. #1521 - ✂ Remove
raw_pycfunction!
macro. #1619 - ✂ Remove
PyClassAlloc
trait. #1657 - Remove
PyList::get_parked_item
. #1664
🛠 Fixed
- ✂ Remove FFI definition
PyCFunction_ClearFreeList
for Python 3.9 and later. #1425 PYO3_CROSS_LIB_DIR
enviroment variable no long required when compiling for x86-64 Python from macOS arm64 and reverse. #1428- Fix FFI definition
_PyEval_RequestCodeExtraIndex
, which took an argument of the wrong type. #1429 - 🛠 Fix FFI definition
PyIndex_Check
missing with theabi3
feature. #1436 - 🛠 Fix incorrect
TypeError
raised when keyword-only argument passed along with a positional argument in*args
. #1440 - 🛠 Fix inability to use a named lifetime for
&PyTuple
of*args
in#[pyfunction]
. #1440 - 🛠 Fix use of Python argument for
#[pymethods]
inside macro expansions. #1505 - No longer include
__doc__
in__all__
generated for#[pymodule]
. #1509 - 🔧 Always use cross-compiling configuration if any of the
PYO3_CROSS
family of environment variables are set. #1514 - 👌 Support
EnvironmentError
,IOError
, andWindowsError
on PyPy. #1533 - 🛠 Fix unneccessary rebuilds when cycling between
cargo check
andcargo clippy
in a Python virtualenv. #1557 - 🛠 Fix segfault when dereferencing
ffi::PyDateTimeAPI
without the GIL. #1563 - 🛠 Fix memory leak in
FromPyObject
implementations foru128
andi128
. #1638 - 🛠 Fix
#[pyclass(extends=PyDict)]
leaking the dict contents on drop. #1657 - 🛠 Fix segfault when calling
PyList::get_item
with negative indices. #1668 - Fix FFI definitions of
PyEval_SetProfile
/PyEval_SetTrace
to takeOption<Py_tracefunc>
parameters. #1692 - 🛠 Fix
ToPyObject
impl forHashSet
to accept non-default hashers. #1702
- ⚡️ Update