You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyO3 0.24.0 added optimized implementations of Iterator::nth and DoubleEndedIterator::nth_back for the BoundListIterator and BoundTupleIterator types. These implementations computed the target index using unchecked usize addition (index + n) before bounds-checking against the sequence length, then read the element via get_item_unchecked.
In nth methods, a sufficiently large n (combined with a non-zero internal index) could cause the addition to overflow and wrap around, producing a small "target index" that passed the bounds check and enabling reads at the front of the list or tuple of elements previously yielded by the iterator.
In nth_back methods, a sufficiently large n could cause underflow in a similar fashion, however would instead allow reads of arbitrary memory past the end of the list or tuple storage.
PyCFunction::new_closure (and the temporary new_closure_bound complement in the 0.21–0.22 series) required the supplied closure to be Send + 'static but not Sync. The resulting PyCFunction is a Python callable that can be invoked from any Python thread, which means the closure may be called concurrently from multiple threads, and needs a Sync bound to prevent possible data races.
The problem exists under all Python versions but is particularly vulnerable under the newer free-threaded Python variant, which do not have serial execution imposed by the Global Interpreter Lock. Under releases protected by the GIL, the ability to "detach" from the Python interpreter temporarily inside the closure (e.g. by Python::detach) makes it possible for interleaved and/or concurrent execution of various portions of the closure.
PyO3 0.29.0 added a Sync bound to close this thread-safety bug.
Add From conversions for PyErr from std::time::TryFromFloatSecsError, std::time::SystemTimeError, std::path::StripPrefixError, std::env::JoinPathsError, std::char::ParseCharError, and std::char::CharTryFromError. #6001
Change exception enrichment on #[pyfunction] argument extraction error to use PyErr::add_note instead of replacing TypeError instances. #5349
Deprecate super-class initialization via tuples. #5741
Change module initialization uses the PyModExport and PyABIInfo APIs on Python 3.15+. #5753
Deprecate Py<T>::get_refcnt and PyAnyMethods::get_refcnt in favor of pyo3::ffi::Py_REFCNT(obj.as_ptr()). #5797
Change PyEnvironmentError, PyIOError, and PyWindowsError to be type aliases of PyOSError (as is the case in Python since 3.3). #5803
Change pyo3_build_config::InterpreterConfig::from_interpreter to require an additional stable_abi_version argument. The old behavior is the same as passing None. #5807
Change PyList::new to no longer have ExactSizeIterator bound. #5830
experimental-inspect: emit #[classattribute] as plain Python class attributes and not functions annotated with @classattribute and @property. #5839
experimental-inspect: use object as the input annotation type of magic methods that return NonImplemented if the input value is not of the correct type. #5841
Remove redundant type checks for methods where CPython guarantees the type of self. #5930
Elide temporary reference count cycles inside PyAnyMethods::call, PyAnyMethods::call1 and PyAnyMethods::call_method1 for arguments passed as Rust tuples containing borrowed references to Python objects. #5941
Allow type annotations to be used in #[pyo3(signature = ...)] when experimental-inspect feature is not enabled (they will be ignored). #5999
pyo3-ffi will now rebuild when the Python virtual environment changes in-place. #6008
Change module initialization on 3.15+ to use PEP 820 PySlot API internally. #6014
Deprecate direct access to all pyo3_build_config::InterpreterConfig fields; getter methods have been added as replacements. #6034
FFI definitions _PyCode_GetExtra, _PyCode_SetExtra, and _PyEval_RequestCodeExtraIndex have been updated to PyUnstable_Code_GetExtra, PyUnstable_Code_SetExtra, and PyUnstable_Eval_RequestCodeExtraIndex. #6038
Change PyCapsule::import to return an error if the pointer is not properly aligned. #6066
Change PyClassGuardMap to be only for PyClassGuard::map and return PyClassGuardMapMut from PyClassGuardMut::map. #6073
Change with_critical_section_mutex2 closure to take Option<EnteredCriticalSection> instead of EnteredCriticalSection as the second argument. #6098
PyClassGuardMut::as_super now returns PyClassGuardMutSuper. #6104
experimental-inspect: Generate relative imports instead of absolute ones (useful if the stubs are not describing a root package) #6097
Removed
Removed the broken (and unfixable) implementations of From<str::Utf8Error>, From<string::FromUtf16Error>, and From<char::DecodeUtf16Error> for PyErr. #5668
Remove Py_TRACE_REFS support (unsupported from Python 3.13). #5824
experimental-inspect: Remove the TypeInfo enum and the FromPyObject::type_input and IntoPyObject::type_output functions. They are replaced by the PyStaticExpr enum and the FromPyObject::INPUT_TYPE and the IntoPyObject::OUTPUT_TYPE associated constants. #5893
Remove all functionality deprecated in PyO3 0.27. #6068
Remove Default for FFI definitions PyHeapTypeObject, PyObjectArenaAllocator, PyHash_FuncDef, and PyType_Spec. #6093
Fixed
Fix add_libpython_rpath_link_args emitting rpath link args on wasm targets which don't support rpath. #5447
Fix From<string::FromUtf8Error> and From<ffi::IntoStringError> for PyErr producing TypeError due to broken internals. #5668
Fix PyMappingProxy::is_type_of and PyWeakrefReference::is_type_of not accepting subclasses. #5883
Fix getattr_opt not treating AttributeError subclasses as missing attributes on Python < 3.13. #5985
Fix compilation error for #[new] return types that contain named lifetimes. #5998
Fix missing 'static bound on PyCapsule destructors. #6049
Fix case where PyFrame::builtins could return a non-dict object. #6052
Fix type confusion when returning a #[pyclass] from a different pyclass' #[new] method. #6062
Fix soundness issue caused by variance in PyClassGuardMap by splitting off the mutable variant. #6073
Fix nondeterministic JSON metadata emitted by the experimental-inspect proc macros (to enable reproducible builds). #6076
Fix UB in PyEval_RestoreThread when the interpreter is shutting down on Python 3.13 and older (hang the thread instead of allowing pthread_exit to jump across Rust frames). #6085
Fix possible out of bounds read in BoundListIterator and BoundTupleIterator's nth and nth_back implementations. #6086
Fix BoundListIterator and BoundTupleIterator not being exhausted when nth or nth_back is called with N larger than the remaining count of items. #6086
Fix missing Sync bound on closure type in PyCFunction::new_closure. #6096
Fix soundness issue caused by exposing a mutable reference from PyClassGuardMut::as_super by moving into PyClassGuardMutSuper. #6104
FFI definitions:
Fix missing FFI definition for PyTypeObject.tp_versions_used on Python 3.13 and newer. #5917
Mark FFI definitions no longer available on 3.11 and up: PyUnicode_Encode, PyUnicode_EncodeASCII, PyUnicode_EncodeCharmap, PyUnicode_EncodeDecimal, PyUnicode_EncodeLatin1, PyUnicode_EncodeRawUnicodeEscape, PyUnicode_EncodeUTF7, PyUnicode_EncodeUTF8, PyUnicode_EncodeUTF16, PyUnicode_EncodeUTF32, PyUnicode_EncodeUnicodeEscape, PyUnicode_TransformDecimalToASCII, and PyUnicode_TranslateCharmap. #6041
Mark FFI definition PyUnicode_ClearFreeList no longer available on 3.9 and up. #6041
Fix *args / **kwargs support in experimental-async feature (regressed in 0.28.0). #5771
Fix clippy::declare_interior_mutable_const warning inside #[pyclass] generated code on enums. #5772
Fix ambiguous_associated_items compilation error when deriving FromPyObject or using #[pyclass(from_py_object)] macro on enums with Error variant. #5784
Fix __qualname__ for complex #[pyclass] enum variants to include the enum name. #5796
Fix missing std::sync::atomic::Ordering import for targets without atomic64. #5808
Add PyBackedStr::clone_ref and PyBackedBytes::clone_ref methods. #5654
Add PyCapsule::new_with_pointer and PyCapsule::new_with_pointer_and_destructor for creating capsules with raw pointers. #5689
Add #[deleter] attribute to implement property deleters in #[methods]. #5699
Add IntoPyObject and FromPyObject implementations for uuid::NonNilUuid. #5707
Add PyBackedStr::as_str and PyBackedStr::as_py_str methods. #5723
Add support for subclassing native types (PyDict, exceptions, ...) when building for abi3 on Python 3.12+. #5733
Add support for subclassing PyList when building for Python 3.12+. #5734
FFI definitions:
Add FFI definitions PyEval_GetFrameBuiltins, PyEval_GetFrameGlobals and PyEval_GetFrameLocals on Python 3.13 and up. #5590
Add FFI definitions PyObject_New, PyObject_NewVar, PyObject_GC_Resize, PyObject_GC_New, and PyObject_GC_NewVar. #5591
Added FFI definitions and an unsafe Rust API wrapping Py_BEGIN_CRITICAL_SECTION_MUTEX and Py_BEGIN_CRITICAL_SECTION_MUTEX2. #5642
Add FFI definition PyDict_GetItemStringRef on Python 3.13 and up. #5659
Add FFI definition PyIter_NextItem on Python 3.14 and up, and compat::PyIter_NextItem for older versions. #5661
Add FFI definitions PyThreadState_GetInterpreter and PyThreadState_GetID on Python 3.9+, PyThreadState_EnterTracing and PyThreadState_LeaveTracing on Python 3.11+, PyThreadState_GetUnchecked on Python 3.13+, and compat::PyThreadState_GetUnchecked. #5711
Add FFI definitions PyImport_ImportModuleAttr and PyImport_ImportModuleAttrString on Python 3.14+. #5737
Add FFI definitions for the PyABIInfo and PyModExport APIs available in Python 3.15. #5746
Fix PyModuleMethods::add_submodule() to use the last segment of the submodule name as the attribute name on the parent module instead of using the full name. #5375
Link with libpython for Cygwin extension modules. #5571
Link against the limited API DLL for Cygwin when abi3 is used. #5574
Handle errors in PyIterator when calling size_hint#5604
Link with libpython for iOS extension modules. #5605
Correct IntoPyObject output type of PyBackedStr to be PyString, not PyAny. #5655
Fix async functions to return None rather than empty tuple (). #5685
Fix compile error when using references to #[pyclass] types (e.g. &MyClass) as arguments to async #[pyfunction]s. #5725
FFI definitions:
Fix FFI definition PyMemberDescrObject.d_member to use PyMemberDef for Python 3.11+ (was incorrectly PyGetSetDef). #5647
Mark FFI definition PyThreadState_GetFrame available with abi3 in 3.10+. #5711
Fix FFI definition PyImport_GetModule on PyPy. #5737
experimental-inspect:
fix __new__ return type to be the built object type and not None. #5555
Deprecate unchecked PyCapsuleMethods: pointer(), reference(), and is_valid(). #5474
Reduce lifetime of return value in PyCapsuleMethods::reference. #5474
PyCapsuleMethods::name now returns CapsuleName wrapper instead of &CStr. #5474
Deprecate import_exception_bound in favour of import_exception. #5480
PyList::get_item_unchecked, PyTuple::get_item_unchecked, and PyTuple::get_borrowed_item_unchecked no longer check for null values at the provided index. #5494
Allow converting naive datetime into chrono DateTime<Local>. #5507
Set the same maximum supported version for alternative interpreters as for CPython. #5192
Add optional bytes dependency to add conversions for bytes::Bytes. #5252
Publish new crate pyo3-introspection to pair with the experimental-inspect feature. #5300
The PYO3_BUILD_EXTENSION_MODULE now causes the same effect as the extension-module feature. Eventually we expect maturin and setuptools-rust to set this environment variable automatically. Users with their own build systems will need to do the same. #5343
Added
Add #[pyo3(warn(message = "...", category = ...))] attribute for automatic warnings generation for #[pyfunction] and #[pymethods]. #4364
Add PyMutex, available on Python 3.13 and newer. #4523
Add FFI definition PyMutex_IsLocked, available on Python 3.14 and newer. #4523
Use Py_TPFLAGS_DISALLOW_INSTANTIATION instead of a __new__ which always fails for a #[pyclass] without a #[new] on Python 3.10 and up. #4568
PyModule::from_code now defaults file_name to <string> if empty. #4777
Deprecate PyString::from_object in favour of PyString::from_encoded_object. #5017
When building with abi3 for a Python version newer than pyo3 supports, automatically fall back to an abi3 build for the latest supported version. #5144
Change is_instance_of trait bound from PyTypeInfo to PyTypeCheck. #5146
Many PyO3 proc macros now report multiple errors instead of only the first one. #5159
Change MutexExt return type to be an associated type. #5201
Use PyCallArgs for Py::call and friends so they're equivalent to their Bound counterpart. #5206
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
any of the package files in this branch needs updating, or
the branch becomes conflicted, or
you click the rebase/retry checkbox if found above, or
you rename this PR's title to start with "rebase!" to trigger it manually
The artifact failure details are included below:
File name: Cargo.lock
Command failed: cargo update --config net.git-fetch-with-cli=true --manifest-path bindings/python/Cargo.toml --workspace
error: failed to parse manifest at `/tmp/renovate/repos/github/codegen-sh/pink/bindings/python/Cargo.toml`
Caused by:
error inheriting `edition` from workspace root manifest's `workspace.package.edition`
Caused by:
failed searching for potential workspace
package manifest: `/tmp/renovate/repos/github/codegen-sh/pink/bindings/python/Cargo.toml`
invalid potential workspace manifest: `/tmp/renovate/repos/github/codegen-sh/pink/Cargo.toml`
help: to avoid searching for a non-existent workspace, add `[workspace]` to the package manifest
Caused by:
failed to parse manifest at `/tmp/renovate/repos/github/codegen-sh/pink/Cargo.toml`
Caused by:
the cargo feature `codegen-backend` requires a nightly version of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
See https://doc.rust-lang.org/cargo/reference/unstable.html#codegen-backend for more information about using this feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
0 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.25.1→0.29.0Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
PyO3 has an Out-of-bounds Read in
nth/nth_backforPyListandPyTupleiteratorsGHSA-36hh-v3qg-5jq4
More information
Details
PyO3 0.24.0 added optimized implementations of
Iterator::nthandDoubleEndedIterator::nth_backfor theBoundListIteratorandBoundTupleIteratortypes. These implementations computed the target index using uncheckedusizeaddition (index + n) before bounds-checking against the sequence length, then read the element viaget_item_unchecked.In
nthmethods, a sufficiently largen(combined with a non-zero internal index) could cause the addition to overflow and wrap around, producing a small "target index" that passed the bounds check and enabling reads at the front of thelistortupleof elements previously yielded by the iterator.In
nth_backmethods, a sufficiently largencould cause underflow in a similar fashion, however would instead allow reads of arbitrary memory past the end of thelistortuplestorage.Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
PyO3 has a missing
Syncbound onPyCFunction::new_closureclosuresGHSA-chgr-c6px-7xpp
More information
Details
PyCFunction::new_closure(and the temporarynew_closure_boundcomplement in the 0.21–0.22 series) required the supplied closure to beSend + 'staticbut notSync. The resultingPyCFunctionis a Python callable that can be invoked from any Python thread, which means the closure may be called concurrently from multiple threads, and needs aSyncbound to prevent possible data races.The problem exists under all Python versions but is particularly vulnerable under the newer free-threaded Python variant, which do not have serial execution imposed by the Global Interpreter Lock. Under releases protected by the GIL, the ability to "detach" from the Python interpreter temporarily inside the closure (e.g. by
Python::detach) makes it possible for interleaved and/or concurrent execution of various portions of the closure.PyO3 0.29.0 added a
Syncbound to close this thread-safety bug.Severity
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
pyo3/pyo3 (pyo3)
v0.29.0Compare Source
Packaging
abi3tandabi3t-py315features. #5807pyo3-macros-backendno longer depends onpyo3-build-config. #5809hashbrownoptional dependency to include version 0.17. #5973pyo3-ffiis nowno_std. #6022Added
PyErr::set_tracebackto set the traceback of an exception object. #5349PyUnicodeDecodeError::new_err_from_utf8to create aPyErrfrom astr::Utf8Error. #5668experimental-inspect: implementINPUT_TYPEandOUTPUT_TYPEon optional third-party crate conversions. #5770experimental-inspect: include doc comments in generated stubs. #5782pyo3_build_config::PythonAbi,pyo3_build_config::PythonAbiKind,pyo3_build_config::PythonAbiBuilder,pyo3_build_config::InterpreterConfig::target_abi, andpyo3_build_config::InterpreterConfigBuilder::target_abi. #5807Borrowed::getas an equivalent toBound::getandPy::get. #5849PyFrame::new,PyTraceBack::new, andPyFrameMethods::line_number. #5857PyUntypedBuffer::objto retrieve the Python object owning the buffer. #5870PyCapsule::new_with_valueandPyCapsule::new_with_value_and_destructor. #5881PyErr::set_contextandPyErr::context. #5887pyo3-introspectionto generate stubs. #5904Python::version_str. #5921TryFrom<&Bound<T>>forPyRef<T>,PyRefMut<T>,PyClassGuard<T>andPyClassGuardMut<T>. #5922From<&Bound<T>>forBound<T>andPy<T>#5922PyDictMethods::set_defaultandPyDictMethods::set_default_refto allow atomically setting default values in a PyDict. #5955PyFrameMethods::outer|code|var|builtins|globals|locals. #5967Fromconversions forPyErrfromstd::time::TryFromFloatSecsError,std::time::SystemTimeError,std::path::StripPrefixError,std::env::JoinPathsError,std::char::ParseCharError, andstd::char::CharTryFromError. #6001pyo3_build_config::InterpreterConfigBuilder. #6034PyCapsule::import_pointer#6066PyClassGuardMapMut. #6073PyListMethods::get_item_unchecked,PyTupleMethods::get_item_unchecked, andPyTupleMethods::get_borrowed_item_uncheckedon abi3. #6075PyClassGuardMapSuper. #6104PyClassGuardandPyClassGuardMuttopyo3::prelude. #6112Debugimpls forPyClassGuardandPyClassGuardMut. #6112PyDateTime,PyDate,PyTime,PyDeltaandPyTzInfoon abi3 with python 3.12+. #6115PyFunctionavailable on abi3. #6117PyUnstable_Object_IsUniquelyReferenced,PyUnstable_Object_IsUniquelyReferencedTemporary,PyUnstable_EnableTryIncref, andPyUnstable_TryIncref. #5828ffi::PyErr_GetHandledExceptionandffi::PyErr_SetHandledException. #5887Py_HASH_SIPHASH13. #5891PyStructSequence_UnnamedFieldconstant on Python 3.9 and up (or 3.11 with abi3 features). #5892PyUnstable_InterpreterFrame_GetCode,PyUnstable_InterpreterFrame_GetLasti,PyUnstable_InterpreterFrame_GetLine, andPyUnstable_ExecutableKinds. #5932PyMarshal_WriteLongToFile,PyMarshal_WriteObjectToFile,PyMarshal_ReadLongFromFile,PyMarshal_ReadShortFromFile,PyMarshal_ReadObjectFromFile, andPyMarshal_ReadLastObjectFromFile. #5934PyObject_GetAIter,PyAIter_Check,PyMapping_HasKeyWithError,PyMapping_HasKeyStringWithError,PyMapping_GetOptionalItem,PyMapping_GetOptionalItemString,PySequence_ITEM,PySequence_Fast_GET_SIZE,PySequence_Fast_GET_ITEM, andPySequence_Fast_ITEMS. #5942compat::PyObject_HasAttrWithError. #5944PyDict_SetDefault,PyDict_SetDefaultRef,PyDict_ContainsString,PyDict_Pop,PyDict_PopString,PyDict_ClearWatcher,PyDict_Watch,PyDict_Unwatch, andPyFrozenDict_New. #5947PyDate_FromDate,PyDateTime_FromDateAndTime,PyDateTime_FromDateAndTimeAndFold,PyTime_FromTime,PyTime_FromTimeAndFold, andPyDelta_FromDSU. #5949PyDict_SetDefaultRefandcompat::PyDict_SetDefaultRef. #5955versions.
cpython/bytearrayobject.h. #5966PyCellObjectand associated functions. #5978PyErr_WarnExplicitObject. #5979PyTracebackObject. #5980PyTuple_FromArrayon 3.15+. #5990and newer. #6014
PyLongimport / export API on Python 3.14+. #6016PyEval_SetProfileAllThreadsandPyEval_SetTraceAllThreads. #6038Py_UNICODE_TODECIMAL. #6041Changed
#[pyfunction]argument extraction error to usePyErr::add_noteinstead of replacingTypeErrorinstances. #5349Py<T>::get_refcntandPyAnyMethods::get_refcntin favor ofpyo3::ffi::Py_REFCNT(obj.as_ptr()). #5797PyEnvironmentError,PyIOError, andPyWindowsErrorto be type aliases ofPyOSError(as is the case in Python since 3.3). #5803pyo3_build_config::InterpreterConfig::from_interpreterto require an additionalstable_abi_versionargument. The old behavior is the same as passingNone. #5807PyList::newto no longer haveExactSizeIteratorbound. #5830experimental-inspect: emit#[classattribute]as plain Python class attributes and not functions annotated with@classattributeand@property. #5839experimental-inspect: useobjectas the input annotation type of magic methods that returnNonImplementedif the input value is not of the correct type. #5841pyo3-build-config/resolve-configfeature. #5862pyo3-ffito use raw-dylib for Windows linking. #5866generate-import-libfeature. #5866PyCapsule::new. #5889PyDate::from_timestampargument is now af64(the Python API expects a float and not an integer) #5896experimental-inspect: ChangePathBuf::extractinput type hint fromstr | os.PathLiketostr | os.PathLike[str]#5897PythonVersionInfo. #5921self. #5930PyAnyMethods::call,PyAnyMethods::call1andPyAnyMethods::call_method1for arguments passed as Rust tuples containing borrowed references to Python objects. #5941#[pyo3(signature = ...)]whenexperimental-inspectfeature is not enabled (they will be ignored). #5999pyo3-ffiwill now rebuild when the Python virtual environment changes in-place. #6008pyo3_build_config::InterpreterConfigfields; getter methods have been added as replacements. #6034_PyCode_GetExtra,_PyCode_SetExtra, and_PyEval_RequestCodeExtraIndexhave been updated toPyUnstable_Code_GetExtra,PyUnstable_Code_SetExtra, andPyUnstable_Eval_RequestCodeExtraIndex. #6038PyCapsule::importto return an error if the pointer is not properly aligned. #6066PyClassGuardMapto be only forPyClassGuard::mapand returnPyClassGuardMapMutfromPyClassGuardMut::map. #6073with_critical_section_mutex2closure to takeOption<EnteredCriticalSection>instead ofEnteredCriticalSectionas the second argument. #6098PyClassGuardMut::as_supernow returnsPyClassGuardMutSuper. #6104experimental-inspect: Generate relative imports instead of absolute ones (useful if the stubs are not describing a root package) #6097Removed
From<str::Utf8Error>,From<string::FromUtf16Error>, andFrom<char::DecodeUtf16Error>forPyErr. #5668Py_TRACE_REFSsupport (unsupported from Python 3.13). #5824experimental-inspect: Remove theTypeInfoenum and theFromPyObject::type_inputandIntoPyObject::type_outputfunctions. They are replaced by thePyStaticExprenum and theFromPyObject::INPUT_TYPEand theIntoPyObject::OUTPUT_TYPEassociated constants. #5893_PyStack_AsDict,_PyObject_CallNoArg,_PyObject_FastCall,_PyObject_FastCallTstate._PyObject_VectorcallTstate,_PyObject_MakeTpCall,_Py_CheckFunctionResult,_PyObject_CallFunction_SizeT,_PyObject_CallMethod_SizeT, and_PySequence_IterSearch. #5942PY_ITERSEARCH_COUNT,PY_ITERSEARCH_INDEX, andPY_ITERSEARCH_CONTAINS. #5942_PySet_NextEntry, and_PyLong_NumBits. #5946_PyFloat_CAST,_PyRun_SimpleFileObject,_PyRun_AnyFileObject,_PyRun_InteractiveLoopObject,_PyUnicode_CheckConsistency,_PyUnicode_COMPACT_DATA,_PyUnicode_NONCOMPACT_DATA,_PyUnicode_Ready, and_Py_HashBytes. #6036_PyEval_EvalFrameDefault. #6038_PyBytes_Resize. #6042_PyErr_BadInternalCall,_Py_GetAllocatedBlocks,_PyObject_GC_Malloc,_PyObject_GC_Calloc, and_PyLong_NumBits. #6053Defaultfor FFI definitionsPyHeapTypeObject,PyObjectArenaAllocator,PyHash_FuncDef, andPyType_Spec. #6093Fixed
add_libpython_rpath_link_argsemitting rpath link args on wasm targets which don't support rpath. #5447From<string::FromUtf8Error>andFrom<ffi::IntoStringError>forPyErrproducingTypeErrordue to broken internals. #5668PyMappingProxy::is_type_ofandPyWeakrefReference::is_type_ofnot accepting subclasses. #5883getattr_optnot treatingAttributeErrorsubclasses as missing attributes on Python < 3.13. #5985#[new]return types that contain named lifetimes. #5998'staticbound onPyCapsuledestructors. #6049PyFrame::builtinscould return a non-dict object. #6052#[pyclass]from a different pyclass'#[new]method. #6062PyClassGuardMapby splitting off the mutable variant. #6073experimental-inspectproc macros (to enable reproducible builds). #6076PyEval_RestoreThreadwhen the interpreter is shutting down on Python 3.13 and older (hang the thread instead of allowingpthread_exitto jump across Rust frames). #6085BoundListIteratorandBoundTupleIterator'snthandnth_backimplementations. #6086BoundListIteratorandBoundTupleIteratornot being exhausted whennthornth_backis called with N larger than the remaining count of items. #6086Syncbound on closure type inPyCFunction::new_closure. #6096PyClassGuardMut::as_superby moving intoPyClassGuardMutSuper. #6104PyTypeObject.tp_versions_usedon Python 3.13 and newer. #5917PyUnicode_Encode,PyUnicode_EncodeASCII,PyUnicode_EncodeCharmap,PyUnicode_EncodeDecimal,PyUnicode_EncodeLatin1,PyUnicode_EncodeRawUnicodeEscape,PyUnicode_EncodeUTF7,PyUnicode_EncodeUTF8,PyUnicode_EncodeUTF16,PyUnicode_EncodeUTF32,PyUnicode_EncodeUnicodeEscape,PyUnicode_TransformDecimalToASCII, andPyUnicode_TranslateCharmap. #6041PyUnicode_ClearFreeListno longer available on 3.9 and up. #6041PyErr_SetInterruptExmissingc_intreturn type. #6043PyBuffer_SizeFromFormaton Python 3.8 (was changed fromc_inttoPy_ssize_ton Python 3.9). #6090PyUnicode_Tailmatchon PyPy (isc_int, unlike CPython). #6090v0.28.3Compare Source
Fixed
#[pyclass(get_all)]on a type namedProbe. #5837_Py_NegativeRefcountwith Python < 3.12. #5847Python::attachortry_attachcould return beforesite.pyhad finished running. #5903PyBytesWriter::write_vectoredwith Python 3.15 prerelease versions. #5907.into_pyobject()implementation for C-like#[pyclass]enums. #5928v0.28.2Compare Source
Fixed
__qualname__not using python name #5815PyType_GetTypeDataSize(was incorrectly namedPyObject_GetTypeDataSize). #5819abi3feature on Python 3.12+ (newly enabled in PyO3 0.28.0). #5823v0.28.1Compare Source
Fixed
*args/**kwargssupport inexperimental-asyncfeature (regressed in 0.28.0). #5771clippy::declare_interior_mutable_constwarning inside#[pyclass]generated code on enums. #5772ambiguous_associated_itemscompilation error when derivingFromPyObjector using#[pyclass(from_py_object)]macro on enums withErrorvariant. #5784__qualname__for complex#[pyclass]enum variants to include the enum name. #5796std::sync::atomic::Orderingimport for targets without atomic64. #5808v0.28.0Compare Source
Packaging
quoteversion to 1.0.37. #5531memoffsetdependency. #5545target-lexicondependency to 0.13.3. #5571indocandunindentdependencies. #5608Added
__init__support in#[pymethods]. #4951PySuperon PyPy, GraalPy and ABI3 #4951PyString::from_fmtandpy_format!macro. #5199#[pyclass(new = "from_fields")]option. #5421pyo3::buffer::PyUntypedBuffer, a type-erased form ofPyBuffer<T>. #5458PyBytes::new_with_writer#5517PyClass::NAME. #5579pyo3_build_config::add_libpython_rpath_link_args. #5624PyBackedStr::clone_refandPyBackedBytes::clone_refmethods. #5654PyCapsule::new_with_pointerandPyCapsule::new_with_pointer_and_destructorfor creating capsules with raw pointers. #5689#[deleter]attribute to implement property deleters in#[methods]. #5699IntoPyObjectandFromPyObjectimplementations foruuid::NonNilUuid. #5707PyBackedStr::as_strandPyBackedStr::as_py_strmethods. #5723PyDict, exceptions, ...) when building for abi3 on Python 3.12+. #5733PyListwhen building for Python 3.12+. #5734PyEval_GetFrameBuiltins,PyEval_GetFrameGlobalsandPyEval_GetFrameLocalson Python 3.13 and up. #5590PyObject_New,PyObject_NewVar,PyObject_GC_Resize,PyObject_GC_New, andPyObject_GC_NewVar. #5591Py_BEGIN_CRITICAL_SECTION_MUTEXandPy_BEGIN_CRITICAL_SECTION_MUTEX2. #5642PyDict_GetItemStringRefon Python 3.13 and up. #5659PyIter_NextItemon Python 3.14 and up, andcompat::PyIter_NextItemfor older versions. #5661PyThreadState_GetInterpreterandPyThreadState_GetIDon Python 3.9+,PyThreadState_EnterTracingandPyThreadState_LeaveTracingon Python 3.11+,PyThreadState_GetUncheckedon Python 3.13+, andcompat::PyThreadState_GetUnchecked. #5711PyImport_ImportModuleAttrandPyImport_ImportModuleAttrStringon Python 3.14+. #5737PyABIInfoandPyModExportAPIs available in Python 3.15. #5746experimental-inspect:@typing.finalon final classes. #5552asynckeyword for async functions. #5731Changed
sys.unraisablehookinstead ofPyErr_Printif panicking on null FFI pointer inBound,BorrowedandPyconstructors. #5496#[pymodule]. #5525FromPyObjectfor#[pyclass]. #5550PyTypeInfo::NAMEandPyTypeInfo::MODULE. #5579Py<T>::from_{owned,borrowed}[or_{err,opt}]constructors from raw pointer. #5585PyEval_AcquireLockandPyEval_ReleaseLock. #5590'py: 'abound inPy::extract. #5594T: PyTypeCheckbound to theIntoPyObjectimplementations onBound<T>,Borrowed<T>andPy<T>. #5640with_critical_sectionandwith_critical_section2functions are moved topyo3::sync::critical_section. #5642PyIter_NextIteminPyIterator::nextimplementation. #5661IntoPyObjectfor simple enums now uses a singleton value, allowing identity (pythonis) comparisons. #5665Sequence[int]inFromPyObjectonCow<[u8]>and change the error type toPyErr. #5667asyncpymethods now borrowselfonly for the duration of awaiting the future, not the entire method call. #5684CastErrorformatted message to directly describe the "is not an instance of" failure condition. #5693#[inline]hints to many methods onPyBackedStr. #5723BoundSetIteratorandBoundFrozenSetIterator. #5725PyIterator::size_hinton abi3 builds (previously was only on unlimited API builds). #5727PyImport_ImportModuleNoBlock(deprecated in Python 3.13). #5737#[new]can now return arbitrary Python objects. #5739experimental-inspect:TypeHintand make use of it to encode type hint annotations. #5438PyType{Info,Check}::TYPE_INFOintoPyType{Info,Check}::TYPE_HINT. #5438 #5619 #5641_typeshed.Incompleteinstead oftyping.Anyas default type hint, to make it easier to spot incomplete trait implementations. #5744Removed
PyEval_GetCallStats(removed from CPython in Python 3.7). #5590PyEval_AcquireLockandPyEval_ReleaseLockon Python 3.13 and up. #5590_PyObject_New,_PyObject_NewVar,_PyObject_GC_Resize,_PyObject_GC_New, and_PyObject_GC_NewVar. #5591_PyDict_SetItem_KnownHash,_PyDict_Next,_PyDict_NewPresized,_PyDict_Contains_KnownHash, and_PyDict_Contains. #5659_PyFrameEvalFunction,_PyInterpreterState_GetEvalFrameFuncand_PyInterpreterState_SetEvalFrameFunc. #5711_PyImport_IsInitialized,_PyImport_SetModule,_PyImport_SetModuleString,_PyImport_AcquireLock,_PyImport_ReleaseLock,_PyImport_FindBuiltin,_PyImport_FindExtensionObject,_PyImport_FixupBuiltin, and_PyImport_FixupExtensionObject. #5737Fixed
PyModuleMethods::add_submodule()to use the last segment of the submodule name as the attribute name on the parent module instead of using the full name. #5375PyIteratorwhen callingsize_hint#5604IntoPyObjectoutput type ofPyBackedStrto bePyString, notPyAny. #5655asyncfunctions to returnNonerather than empty tuple(). #5685#[pyclass]types (e.g.&MyClass) as arguments to async#[pyfunction]s. #5725PyMemberDescrObject.d_memberto usePyMemberDeffor Python 3.11+ (was incorrectlyPyGetSetDef). #5647PyThreadState_GetFrameavailable with abi3 in 3.10+. #5711PyImport_GetModuleon PyPy. #5737experimental-inspect:__new__return type to be the built object type and notNone. #5555PyResult<()>(must beNoneand nottuple) #5674v0.27.2Compare Source
Changed
PyDicton GraalPy (unsupported for now, may crash at runtime). #5653Fixed
PyDictObjecton PyPy. #5653v0.27.1Compare Source
Fixed
clippy:declare_interior_mutable_constwarning from#[pyfunction]. #5538pyo3::types::PySendResultin public API. #5539v0.27.0Compare Source
Packaging
hashbrownoptional dependency to include version 0.16. #5428num-bigintdependency minimum version to 0.4.4. #5471Added
FromPyObjectOwnedas convenient trait bound forFromPyObjectwhen the data is not borrowed from Python. #4390Borrowed::extract, same asPyAnyMethods::extract, but does not restrict the lifetime by deref. #4390experimental-inspect: basic support for#[derive(IntoPyObject)](no struct fields support yet). #5365experimental-inspect: support#[pyo3(get, set)]and#[pyclass(get_all, set_all)]. #5370PyTypeCheck::classinfo_objectthat returns an object that can be used as parameter inisinstanceorissubclass. #5387PyTypeInfoondatetime.*types even when the limited API is enabled. #5388PyTypeInfoonPyIterator,PyMappingandPySequence. #5402PyTypeInfoonPyCodewhen using the stable ABI. #5403PyTypeInfoonPyWeakrefReferencewhen using the stable ABI. #5404pyo3::sync::RwLockExttrait, analogous topyo3::sync::MutexExtfor readwrite locks. #5435PyString::from_bytes. #5437AsRef<[u8]>forPyBytes. #5445CastErrorandCastIntoError. #5468PyCapsuleMethods::pointer_checkedandPyCapsuleMethods::is_valid_checked. #5474Borrowed::cast,Borrowed::cast_exactandBorrowed::cast_unchecked. #5475jiff::civil::ISOWeekDate. #5478&Cstr,CstringandCow<Cstr>. #5482#[pyclass(skip_from_py_object)]option, to opt-out of theFromPyObject: PyClass + Cloneblanket impl. #5488PyErr::add_note. #5489FromPyObjectimpl forCow<Path>&Cow<OsStr>. #5497#[pyclass(from_py_object)]pyclass option, to opt-in to the extraction of pyclasses by value (requiresClone). #5506Changed
FromPyObjecttrait for flexibility and performance: #4390FromPyObject, to allow borrowing data from Python objects (e.g.&strfrom Pythonstr).extract_boundwithextract, which takesBorrowed<'a, 'py, PyAny>.FromPyObjectimplementations forVec<u8>and[u8; N]frombytesandbytearray. #5244#[pyfn]attribute. #5384PyTypeCheck::NAME. #5387PyTypeCheck::NAMEin favour ofPyTypeCheck::classinfo_objectwhich provides the type information at runtime. #5387PyClassGuard(Mut)andPyRef(Mut)extraction now returns an opaque Rust error #5413PyTypeInfowith#[pymodule_use]. #5414Debugrepresentation ofPyBuffer<T>. #5442experimental-inspect: change the way introspection data is emitted in the binaries to avoid a pointer indirection and simplify parsing. #5450Py<T>::dropfor the case when attached to the Python interpreter. #5454DowncastErrorandDowncastIntoErrorwithCastErrorandCastIntoError. #5468GraalPy. #5471PyAnyMethods::downcastfunctions in favour ofBound::castfunctions. #5472PyTypeCheckanunsafe trait. #5473PyCapsuleMethods:pointer(),reference(), andis_valid(). #5474PyCapsuleMethods::reference. #5474PyCapsuleMethods::namenow returnsCapsuleNamewrapper instead of&CStr. #5474import_exception_boundin favour ofimport_exception. #5480PyList::get_item_unchecked,PyTuple::get_item_unchecked, andPyTuple::get_borrowed_item_uncheckedno longer check for null values at the provided index. #5494DateTime<Local>. #5507Removed
FromPyObjectBoundtrait. #4390Fixed
wasm32-wasip2. #5368OsStrconversion for non-utf8 strings on Windows. #5444cargo vendorcaused by gitignored build artifactemscripten/pybuilddir.txt. #5456PyMethodDefinstances inside#[pyfunction]macro generated code. #5459PyObjectObFlagsAndRefcnton 32-bit Python 3.14 (doesn't exist). #5499abi3interpreters on Windows using maturin's built-in sysconfig in combination with thegenerate-import-libfeature. #5503PyModule_ExecDefandPyModule_FromDefAndSpec2on PyPy. #5529v0.26.0Compare Source
Packaging
bytesdependency to add conversions forbytes::Bytes. #5252pyo3-introspectionto pair with theexperimental-inspectfeature. #5300PYO3_BUILD_EXTENSION_MODULEnow causes the same effect as theextension-modulefeature. Eventually we expect maturin and setuptools-rust to set this environment variable automatically. Users with their own build systems will need to do the same. #5343Added
#[pyo3(warn(message = "...", category = ...))]attribute for automatic warnings generation for#[pyfunction]and#[pymethods]. #4364PyMutex, available on Python 3.13 and newer. #4523PyMutex_IsLocked, available on Python 3.14 and newer. #4523PyString::from_encoded_object. #5017experimental-inspect: add basic input type annotations. #5089PyFrameObjectfrom CPython 3.13. #5154experimental-inspect: tag modules created using#[pymodule]or#[pymodule_init]functions as incomplete. #5207experimental-inspect: add basic return type support. #5208PyCode::compileandPyCodeMethods::runto create and execute code objects. #5217PyOnceLocktype for thread-safe single-initialization. #5223PyClassGuard(Mut)pyclass holders. In the future they will replacePyRef(Mut). #5233experimental-inspect: allow annotations in#[pyo3(signature)]signature attribute. #5241MutexExtfor parking_lot's/lock_apiReentrantMutex. #5258experimental-inspect: support class associated constants. #5272Bound::castfamily of functions superseding thePyAnyMethods::downcastfamily. #5289Py_VersionandPy_IsFinalizing. #5317experimental-inspect: add output type annotation for#[pyclass]. #5320experimental-inspect: support#[pyclass(eq, eq_int, ord, hash, str)]. #5338experimental-inspect: add basic support for#[derive(FromPyObject)](no struct fields support yet). #5339Python::try_attach. #5342Changed
Py_TPFLAGS_DISALLOW_INSTANTIATIONinstead of a__new__which always fails for a#[pyclass]without a#[new]on Python 3.10 and up. #4568PyModule::from_codenow defaultsfile_nameto<string>if empty. #4777PyString::from_objectin favour ofPyString::from_encoded_object. #5017abi3for a Python version newer than pyo3 supports, automatically fall back to an abi3 build for the latest supported version. #5144is_instance_oftrait bound fromPyTypeInfotoPyTypeCheck. #5146MutexExtreturn type to be an associated type. #5201PyCallArgsforPy::calland friends so they're equivalent to theirBoundcounterpart. #5206Python::with_giltoPython::attach. #5209Python::allow_threadstoPython::detach#5221GILOnceCelltype in favour ofPyOnceLock. #5223pyo3::prepare_freethreaded_pythontoPython::initialize. #5247PyMemoryErrorinto/fromio::ErrorKind::OutOfMemory. #5256GILProtected. #5285#[pyclass]docstring formatting from import time to compile time. #5286Python::attachwill now panic if the Python interpreter is in the process of shutting down. #5317PyTypeInfo::type_objectfor#[pyclass]types. #5324PyObjecttype alias forPy<PyAny>. #5325Python::with_gil_uncheckedtoPython::attach_unchecked. #5340Python::assume_gil_acquiredtoPython::assume_attached. #5354Removed
PyFrameObject. #5154EqandPartialEqimplementations onPyGetSetDefFFI definition. #5196_Py_IsCoreInitializedand_Py_InitializeMain. #5317Fixed
PyByteArray::to_vecon freethreaded build to replicate GIL-enabled "soundness". #4742bigdecimalinto Python. #5198PyBuffer<T>after the Python interpreter has been finalized. #5242experimental-inspect: better automated imports generation. #5251experimental-inspect: fix introspection of__richcmp__,__concat__,__repeat__,__inplace_concat__and__inplace_repeat__. #5273PyRef::into_super#5281Py_Exit(never returns, was()return value, now!). #5317experimental-inspect: fix handling of module members gated behind#[cfg(...)]attributes. #5318Configuration
📅 Schedule: (UTC)
* 0-3 * * 1)🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.