PyO3 v0.17.0 Release Notes
Release Date: 2022-08-23 // over 1 year ago-
Packaging
- ⚡️ Update inventory dependency to
0.3
(themultiple-pymethods
feature now requires Rust 1.62 for correctness). #2492
➕ Added
- ➕ Add
timezone_utc
. #1588 - Implement
ToPyObject
for[T; N]
. #2313 - ➕ Add
PyDictKeys
,PyDictValues
andPyDictItems
Rust types. #2358 - Add
append_to_inittab
. #2377 - ➕ Add FFI definition
PyFrame_GetCode
. #2406 - ➕ Add
PyCode
andPyFrame
high level objects. #2408 - Add FFI definitions
Py_fstring_input
,sendfunc
, and_PyErr_StackItem
. #2423 - Add
PyDateTime::new_with_fold
,PyTime::new_with_fold
,PyTime::get_fold
, andPyDateTime::get_fold
for PyPy. #2428 - Accept
#[pyo3(name)]
on enum variants. #2457 - Add
CompareOp::matches
to implement__richcmp__
as the result of a Ruststd::cmp::Ordering
comparison. #2460 - ➕ Add
PySuper
type. #2486 - 👌 Support PyPy on Windows with the
generate-import-lib
feature. #2506 - Add FFI definitions
Py_EnterRecursiveCall
andPy_LeaveRecursiveCall
. #2511 - Add
PyDict::get_item_with_error
. #2536 - ➕ Add
#[pyclass(sequence)]
option. #2567
🔄 Changed
- Change datetime constructors taking a
tzinfo
to takeOption<&PyTzInfo>
instead ofOption<&PyObject>
:PyDateTime::new
,PyDateTime::new_with_fold
,PyTime::new
, andPyTime::new_with_fold
. #1588 - 🚚 Move
PyTypeObject::type_object
method to thePyTypeInfo
trait, and deprecate thePyTypeObject
trait. #2287 - Methods of
Py
andPyAny
now acceptimpl IntoPy<Py<PyString>>
rather than just&str
to allow use of theintern!
macro. #2312 - 🔄 Change the deprecated
pyproto
feature to be opt-in instead of opt-out. #2322 - 👍 Emit better error messages when
#[pyfunction]
return types do not implementIntoPy
. #2326 - Require
T: IntoPy
forimpl<T, const N: usize> IntoPy<PyObject> for [T; N]
instead ofT: ToPyObject
. #2326 - 🗄 Deprecate the
ToBorrowedObject
trait. #2333 - Iterators over
PySet
andPyDict
will now panic if the underlying collection is mutated during the iteration. #2380 - Iterators over
PySet
andPyDict
will now panic if the underlying collection is mutated during the iteration. #2380 - 👍 Allow
#[classattr]
methods to be fallible. #2385 - Prevent multiple
#[pymethods]
with the same name for a single#[pyclass]
. #2399 - Fixup
lib_name
when usingPYO3_CONFIG_FILE
. #2404 - ➕ Add a message to the
ValueError
raised by the#[derive(FromPyObject)]
implementation for a tuple struct. #2414 - 👍 Allow
#[classattr]
methods to takePython
argument. #2456 - Rework
PyCapsule
type to resolve soundness issues: #2485PyCapsule::new
andPyCapsule::new_with_destructor
now takename: Option<CString>
instead of&CStr
.- The destructor
F
inPyCapsule::new_with_destructor
must now beSend
. PyCapsule::get_context
deprecated in favour ofPyCapsule::context
which doesn't take apy: Python<'_>
argument.PyCapsule::set_context
no longer takes apy: Python<'_>
argument.PyCapsule::name
now returnsPyResult<Option<&CStr>>
instead of&CStr
.
FromPyObject::extract
forVec<T>
no longer accepts Pythonstr
inputs. #2500- Ensure each
#[pymodule]
is only initialized once. #2523 - 🏗
pyo3_build_config::add_extension_module_link_args
now also emits linker arguments forwasm32-unknown-emscripten
. #2538 - Type checks for
PySequence
andPyMapping
now require inputs to inherit from (or register with)collections.abc.Sequence
andcollections.abc.Mapping
respectively. #2477 - 🏗 Disable
PyFunction
on when building for abi3 or PyPy. #2542 - 🗄 Deprecate
Python::acquire_gil
. #2549
✂ Removed
- ✂ Remove all functionality deprecated in PyO3 0.15. #2283
- 👉 Make the
Dict
,WeakRef
andBaseNativeType
members of thePyClass
private implementation details. #2572
🛠 Fixed
- Enable incorrectly disabled FFI definition
PyThreadState_DeleteCurrent
. #2357 - 👀 Fix
wrap_pymodule
interactions with name resolution rules: it no longer "sees through" glob imports ofuse submodule::*
whensubmodule::submodule
is a#[pymodule]
. #2363 - Correct FFI definition
PyEval_EvalCodeEx
to take*const *mut PyObject
array arguments instead of*mut *mut PyObject
. #2368 - 🛠 Fix "raw-ident" structs (e.g.
#[pyclass] struct r#RawName
) incorrectly havingr#
at the start of the class name created in Python. #2395 - Correct FFI definition
Py_tracefunc
to beunsafe extern "C" fn
(was previously safe). #2407 - Fix compile failure with
#[pyo3(from_py_with = "...")]
annotations on a field in a#[derive(FromPyObject)]
struct. #2414 - Fix FFI definitions
_PyDateTime_BaseTime
and_PyDateTime_BaseDateTime
lacking leading underscores in their names. #2421 - ✂ Remove FFI definition
PyArena
on Python 3.10 and up. #2421 - 🔋 Fix FFI definition
PyCompilerFlags
missing membercf_feature_version
on Python 3.8 and up. #2423 - 🛠 Fix FFI definition
PyAsyncMethods
missing memberam_send
on Python 3.10 and up. #2423 - 🛠 Fix FFI definition
PyGenObject
having multiple incorrect members on various Python versions. #2423 - Fix FFI definition
PySyntaxErrorObject
missing membersend_lineno
andend_offset
on Python 3.10 and up. #2423 - 🛠 Fix FFI definition
PyHeapTypeObject
missing memberht_module
on Python 3.9 and up. #2423 - 🛠 Fix FFI definition
PyFrameObject
having multiple incorrect members on various Python versions. #2424 #2434 - 🛠 Fix FFI definition
PyTypeObject
missing deprecated fieldtp_print
on Python 3.8. #2428 - Fix FFI definitions
PyDateTime_CAPI
.PyDateTime_Date
,PyASCIIObject
,PyBaseExceptionObject
,PyListObject
, andPyTypeObject
on PyPy. #2428 - 🛠 Fix FFI definition
_inittab
fieldinitfunc
typo'd asinitfun
. #2431 - Fix FFI definitions
_PyDateTime_BaseTime
and_PyDateTime_BaseDateTime
incorrectly havingfold
member. #2432 - 🛠 Fix FFI definitions
PyTypeObject
.PyHeapTypeObject
, andPyCFunctionObject
having incorrect members on PyPy 3.9. #2433 - Fix FFI definition
PyGetSetDef
to have*const c_char
fordoc
member (not*mut c_char
). #2439 - Fix
#[pyo3(from_py_with = "...")]
being ignored for 1-element tuple structs and transparent structs. #2440 - 👉 Use
memoffset
to avoid UB when computingPyCell
layout. #2450 - 🛠 Fix incorrect enum names being returned by the generated
repr
for enums renamed by#[pyclass(name = "...")]
#2457 - 🛠 Fix
PyObject_CallNoArgs
incorrectly being available when building for abi3 on Python 3.9. #2476 - 🛠 Fix several clippy warnings generated by
#[pyfunction]
arguments. #2503
- ⚡️ Update inventory dependency to