Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Dec 28, 2025

This PR contains the following updates:

Package Type Update Change
pyo3 dependencies minor 0.23 -> 0.27

Release Notes

pyo3/pyo3 (pyo3)

v0.27.2

Compare Source

Changed
  • Disable subclassing PyDict on GraalPy (unsupported for now, may crash at runtime). #​5653
Fixed
  • Fix crash when compiling on Rust 1.92+ with both debug assertions and optimizations enabled. #​5638
  • Fix FFI definition of PyDictObject on PyPy. #​5653

v0.27.1

Compare Source

Fixed
  • Fix clippy:declare_interior_mutable_const warning from #[pyfunction]. #​5538
  • Expose pyo3::types::PySendResult in public API. #​5539

v0.27.0

Compare Source

Packaging
  • Extend range of supported versions of hashbrown optional dependency to include version 0.16. #​5428
  • Bump optional num-bigint dependency minimum version to 0.4.4. #​5471
  • Test against Python 3.14 final release. #​5499
  • Drop support for PyPy 3.9 and 3.10. #​5516
  • Provide a better error message when building an outdated PyO3 for a too-new Python version. #​5519
Added
  • Add FromPyObjectOwned as convenient trait bound for FromPyObject when the data is not borrowed from Python. #​4390
  • Add Borrowed::extract, same as PyAnyMethods::extract, but does not restrict the lifetime by deref. #​4390
  • experimental-inspect: basic support for #[derive(IntoPyObject)] (no struct fields support yet). #​5365
  • experimental-inspect: support #[pyo3(get, set)] and #[pyclass(get_all, set_all)]. #​5370
  • Add PyTypeCheck::classinfo_object that returns an object that can be used as parameter in isinstance or issubclass. #​5387
  • Implement PyTypeInfo on datetime.* types even when the limited API is enabled. #​5388
  • Implement PyTypeInfo on PyIterator, PyMapping and PySequence. #​5402
  • Implement PyTypeInfo on PyCode when using the stable ABI. #​5403
  • Implement PyTypeInfo on PyWeakrefReference when using the stable ABI. #​5404
  • Add pyo3::sync::RwLockExt trait, analogous to pyo3::sync::MutexExt for readwrite locks. #​5435
  • Add PyString::from_bytes. #​5437
  • Implement AsRef<[u8]> for PyBytes. #​5445
  • Add CastError and CastIntoError. #​5468
  • Add PyCapsuleMethods::pointer_checked and PyCapsuleMethods::is_valid_checked. #​5474
  • Add Borrowed::cast, Borrowed::cast_exact and Borrowed::cast_unchecked. #​5475
  • Add conversions for jiff::civil::ISOWeekDate. #​5478
  • Add conversions for &Cstr, Cstring and Cow<Cstr>. #​5482
  • add #[pyclass(skip_from_py_object)] option, to opt-out of the FromPyObject: PyClass + Clone blanket impl. #​5488
  • Add PyErr::add_note. #​5489
  • Add FromPyObject impl for Cow<Path> & Cow<OsStr>. #​5497
  • Add #[pyclass(from_py_object)] pyclass option, to opt-in to the extraction of pyclasses by value (requires Clone). #​5506
Changed
  • Rework FromPyObject trait for flexibility and performance: #​4390
    • Add a second lifetime to FromPyObject, to allow borrowing data from Python objects (e.g. &str from Python str).
    • Replace extract_bound with extract, which takes Borrowed<'a, 'py, PyAny>.
  • Optimize FromPyObject implementations for Vec<u8> and [u8; N] from bytes and bytearray. #​5244
  • Deprecate #[pyfn] attribute. #​5384
  • Fetch type name dynamically on cast errors instead of using PyTypeCheck::NAME. #​5387
  • Deprecate PyTypeCheck::NAME in favour of PyTypeCheck::classinfo_object which provides the type information at runtime. #​5387
  • PyClassGuard(Mut) and PyRef(Mut) extraction now returns an opaque Rust error #​5413
  • Fetch type name dynamically when exporting types implementing PyTypeInfo with #[pymodule_use]. #​5414
  • Improve Debug representation of PyBuffer<T>. #​5442
  • experimental-inspect: change the way introspection data is emitted in the binaries to avoid a pointer indirection and simplify parsing. #​5450
  • Optimize Py<T>::drop for the case when attached to the Python interpreter. #​5454
  • Replace DowncastError and DowncastIntoError with CastError and CastIntoError. #​5468
  • Enable fast-path for 128-bit integer conversions on GraalPy. #​5471
  • Deprecate PyAnyMethods::downcast functions in favour of Bound::cast functions. #​5472
  • Make PyTypeCheck an unsafe trait. #​5473
  • 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
Removed
  • Removed FromPyObjectBound trait. #​4390
Fixed
  • Fix compilation failure on wasm32-wasip2. #​5368
  • Fix OsStr conversion for non-utf8 strings on Windows. #​5444
  • Fix issue with cargo vendor caused by gitignored build artifact emscripten/pybuilddir.txt. #​5456
  • Stop leaking PyMethodDef instances inside #[pyfunction] macro generated code. #​5459
  • Don't export definition of FFI struct PyObjectObFlagsAndRefcnt on 32-bit Python 3.14 (doesn't exist). #​5499
  • Fix failure to build for abi3 interpreters on Windows using maturin's built-in sysconfig in combination with the generate-import-lib feature. #​5503
  • Fix FFI definitions PyModule_ExecDef and PyModule_FromDefAndSpec2 on PyPy. #​5529

v0.26.0

Compare Source

Packaging
  • Bump hashbrown dependency to 0.15. #​5152
  • Update MSRV to 1.74. #​5171
  • 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
  • Add PyString::from_encoded_object. #​5017
  • experimental-inspect: add basic input type annotations. #​5089
  • Add FFI function definitions for PyFrameObject from CPython 3.13. #​5154
  • experimental-inspect: tag modules created using #[pymodule] or #[pymodule_init] functions as incomplete. #​5207
  • experimental-inspect: add basic return type support. #​5208
  • Add PyCode::compile and PyCodeMethods::run to create and execute code objects. #​5217
  • Add PyOnceLock type for thread-safe single-initialization. #​5223
  • Add PyClassGuard(Mut) pyclass holders. In the future they will replace PyRef(Mut). #​5233
  • experimental-inspect: allow annotations in #[pyo3(signature)] signature attribute. #​5241
  • Implement MutexExt for parking_lot's/lock_api ReentrantMutex. #​5258
  • experimental-inspect: support class associated constants. #​5272
  • Add Bound::cast family of functions superseding the PyAnyMethods::downcast family. #​5289
  • Add FFI definitions Py_Version and Py_IsFinalizing. #​5317
  • experimental-inspect: add output type annotation for #[pyclass]. #​5320
  • experimental-inspect: support #[pyclass(eq, eq_int, ord, hash, str)]. #​5338
  • experimental-inspect: add basic support for #[derive(FromPyObject)] (no struct fields support yet). #​5339
  • Add Python::try_attach. #​5342
Changed
  • 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
  • Rename Python::with_gil to Python::attach. #​5209
  • Rename Python::allow_threads to Python::detach #​5221
  • Deprecate GILOnceCell type in favour of PyOnceLock. #​5223
  • Rename pyo3::prepare_freethreaded_python to Python::initialize. #​5247
  • Convert PyMemoryError into/from io::ErrorKind::OutOfMemory. #​5256
  • Deprecate GILProtected. #​5285
  • Move #[pyclass] docstring formatting from import time to compile time. #​5286
  • Python::attach will now panic if the Python interpreter is in the process of shutting down. #​5317
  • Add fast-path to PyTypeInfo::type_object for #[pyclass] types. #​5324
  • Deprecate PyObject type alias for Py<PyAny>. #​5325
  • Rename Python::with_gil_unchecked to Python::attach_unchecked. #​5340
  • Rename Python::assume_gil_acquired to Python::assume_attached. #​5354
Removed
  • Remove FFI definition of internals of PyFrameObject. #​5154
  • Remove Eq and PartialEq implementations on PyGetSetDef FFI definition. #​5196
  • Remove private FFI definitions _Py_IsCoreInitialized and _Py_InitializeMain. #​5317
Fixed
  • Use critical section in PyByteArray::to_vec on freethreaded build to replicate GIL-enabled "soundness". #​4742
  • Fix precision loss when converting bigdecimal into Python. #​5198
  • Don't treat win7 target as a cross-compilation. #​5210
  • WASM targets no longer require exception handling support for Python < 3.14. #​5239
  • Fix segfault when dropping PyBuffer<T> after the Python interpreter has been finalized. #​5242
  • experimental-inspect: better automated imports generation. #​5251
  • experimental-inspect: fix introspection of __richcmp__, __concat__, __repeat__, __inplace_concat__ and __inplace_repeat__. #​5273
  • fixed a leaked borrow, when converting a mutable sub class into a frozen base class using PyRef::into_super #​5281
  • Fix FFI definition Py_Exit (never returns, was () return value, now !). #​5317
  • experimental-inspect: fix handling of module members gated behind #[cfg(...)] attributes. #​5318

v0.25.1

Compare Source

Packaging
  • Add support for Windows on ARM64. #​5145
  • Add chrono-local feature for optional conversions for chrono's Local timezone & DateTime<Local> instances. #​5174
Added
  • Add FFI definition PyBytes_AS_STRING. #​5121
  • Add support for module associated consts introspection. #​5150
Changed
  • Enable "vectorcall" FFI definitions on GraalPy. #​5121
  • Use Py_Is function on GraalPy #​5121
Fixed
  • Report a better compile error for async declarations when not using experimental-async feature. #​5156
  • Fix implementation of FromPyObject for uuid::Uuid on big-endian architectures. #​5161
  • Fix segmentation faults on 32-bit x86 with Python 3.14. #​5180

v0.25.0

Compare Source

Packaging
  • Support Python 3.14.0b1. #​4811
  • Bump supported GraalPy version to 24.2. #​5116
  • Add optional bigdecimal dependency to add conversions for bigdecimal::BigDecimal. #​5011
  • Add optional time dependency to add conversions for time types. #​5057
  • Remove cfg-if dependency. #​5110
  • Add optional ordered_float dependency to add conversions for ordered_float::NotNan and ordered_float::OrderedFloat. #​5114
Added
  • Add initial type stub generation to the experimental-inspect feature. #​3977
  • Add #[pyclass(generic)] option to support runtime generic typing. #​4926
  • Implement OnceExt & MutexExt for parking_lot & lock_api. Use the new extension traits by enabling the arc_lock, lock_api, or parking_lot cargo features. #​5044
  • Implement From/Into for Borrowed<T> -> Py<T>. #​5054
  • Add PyTzInfo constructors. #​5055
  • Add FFI definition PY_INVALID_STACK_EFFECT. #​5064
  • Implement AsRef<Py<PyAny>> for Py<T>, Bound<T> and Borrowed<T>. #​5071
  • Add FFI definition PyModule_Add and compat::PyModule_Add. #​5085
  • Add FFI definitions Py_HashBuffer, Py_HashPointer, and PyObject_GenericHash. #​5086
  • Support #[pymodule_export] on const items in declarative modules. #​5096
  • Add #[pyclass(immutable_type)] option (on Python 3.14+ with abi3, or 3.10+ otherwise) for immutable type objects. #​5101
  • Support #[pyo3(rename_all)] support on #[derive(IntoPyObject)]. #​5112
  • Add PyRange wrapper. #​5117
Changed
  • Enable use of datetime types with abi3 feature enabled. #​4970
  • Deprecate timezone_utc in favor of PyTzInfo::utc. #​5055
  • Reduce visibility of some CPython implementation details: #​5064
    • The FFI definition PyCodeObject is now an opaque struct on all Python versions.
    • The FFI definition PyFutureFeatures is now only defined up until Python 3.10 (it was present in CPython headers but unused in 3.11 and 3.12).
  • Change PyAnyMethods::is to take other: &Bound<T>. #​5071
  • Change Py::is to take other: &Py<T>. #​5071
  • Change PyVisit::call to take T: Into<Option<&Py<T>>>. #​5071
  • Expose PyDateTime_DATE_GET_TZINFO and PyDateTime_TIME_GET_TZINFO on PyPy 3.10 and later. #​5079
  • Add #[track_caller] to with_gil and with_gil_unchecked. #​5109
  • Use std::thread::park() instead of libc::pause() or sleep(9999999). #​5115
Removed
  • Remove all functionality deprecated in PyO3 0.23. #​4982
  • Remove deprecated IntoPy and ToPyObject traits. #​5010
  • Remove private types from pyo3-ffi (i.e. starting with _Py) which are not referenced by public APIs: _PyLocalMonitors, _Py_GlobalMonitors, _PyCoCached, _PyCoLineInstrumentationData, _PyCoMonitoringData, _PyCompilerSrcLocation, _PyErr_StackItem. #​5064
  • Remove FFI definition PyCode_GetNumFree (PyO3 cannot support it due to knowledge of the code object). #​5064
  • Remove AsPyPointer trait. #​5071
  • Remove support for the deprecated string form of from_py_with. #​5097
  • Remove FFI definitions of private static variables: _PyMethodWrapper_Type, _PyCoroWrapper_Type, _PyImport_FrozenBootstrap, _PyImport_FrozenStdlib, _PyImport_FrozenTest, _PyManagedBuffer_Type, _PySet_Dummy, _PyWeakref_ProxyType, and _PyWeakref_CallableProxyType. #​5105
  • Remove FFI definitions PyASCIIObjectState, PyUnicode_IS_ASCII, PyUnicode_IS_COMPACT, and PyUnicode_IS_COMPACT_ASCII on Python 3.14 and newer. #​5133
Fixed
  • Correctly pick up the shared state for conda-based Python installation when reading information from sysconfigdata. #​5037
  • Fix compile failure with #[derive(IntoPyObject, FromPyObject)] when using #[pyo3()] options recognised by only one of the two derives. #​5070
  • Fix various compile errors from missing FFI definitions using certain feature combinations on PyPy and GraalPy. #​5091
  • Fallback on backports.zoneinfo for python <3.9 when converting timezones into python. #​5120

v0.24.2

Compare Source

Fixed
  • Fix unused_imports lint of #[pyfunction] and #[pymethods] expanded in macro_rules context. #​5030
  • Fix size of PyCodeObject::_co_instrumentation_version ffi struct member on Python 3.13 for systems where uintptr_t is not 64 bits. #​5048
  • Fix struct-type complex enum variant fields incorrectly exposing raw identifiers as r#ident in Python bindings. #​5050

v0.24.1

Compare Source

Added
  • Add abi3-py313 feature. #​4969
  • Add PyAnyMethods::getattr_opt. #​4978
  • Add PyInt::new constructor for all supported number types (i32, u32, i64, u64, isize, usize). #​4984
  • Add pyo3::sync::with_critical_section2. #​4992
  • Implement PyCallArgs for Borrowed<'_, 'py, PyTuple>, &Bound<'py, PyTuple>, and &Py<PyTuple>. #​5013
Fixed
  • Fix is_type_of for native types not using same specialized check as is_type_of_bound. #​4981
  • Fix Probe class naming issue with #[pymethods]. #​4988
  • Fix compile failure with required #[pyfunction] arguments taking Option<&str> and Option<&T> (for #[pyclass] types). #​5002
  • Fix PyString::from_object causing of bounds reads with encoding and errors parameters which are not nul-terminated. #​5008
  • Fix compile error when additional options follow after crate for #[pyfunction]. #​5015

v0.24.0

Compare Source

Packaging
  • Add supported CPython/PyPy versions to cargo package metadata. #​4756
  • Bump target-lexicon dependency to 0.13. #​4822
  • Add optional jiff dependency to add conversions for jiff datetime types. #​4823
  • Add optional uuid dependency to add conversions for uuid::Uuid. #​4864
  • Bump minimum supported inventory version to 0.3.5. #​4954
Added
  • Add PyIterator::send method to allow sending values into a python generator. #​4746
  • Add PyCallArgs trait for passing arguments into the Python calling protocol. This enabled using a faster calling convention for certain types, improving performance. #​4768
  • Add #[pyo3(default = ...'] option for #[derive(FromPyObject)] to set a default value for extracted fields of named structs. #​4829
  • Add #[pyo3(into_py_with = ...)] option for #[derive(IntoPyObject, IntoPyObjectRef)]. #​4850
  • Add FFI definitions PyThreadState_GetFrame and PyFrame_GetBack. #​4866
  • Optimize last for BoundListIterator, BoundTupleIterator and BorrowedTupleIterator. #​4878
  • Optimize Iterator::count() for PyDict, PyList, PyTuple & PySet. #​4878
  • Optimize nth, nth_back, advance_by and advance_back_by for BoundTupleIterator #​4897
  • Add support for types.GenericAlias as pyo3::types::PyGenericAlias. #​4917
  • Add MutextExt trait to help avoid deadlocks with the GIL while locking a std::sync::Mutex. #​4934
  • Add #[pyo3(rename_all = "...")] option for #[derive(FromPyObject)]. #​4941
Changed
  • Optimize nth, nth_back, advance_by and advance_back_by for BoundListIterator. #​4810
  • Use DerefToPyAny in blanket implementations of From<Py<T>> and From<Bound<'py, T>> for PyObject. #​4593
  • Map io::ErrorKind::IsADirectory/NotADirectory to the corresponding Python exception on Rust 1.83+. #​4747
  • PyAnyMethods::call and friends now require PyCallArgs for their positional arguments. #​4768
  • Expose FFI definitions for PyObject_Vectorcall(Method) on the stable abi on 3.12+. #​4853
  • #[pyo3(from_py_with = ...)] now take a path rather than a string literal #​4860
  • Format Python traceback in impl Debug for PyErr. #​4900
  • Convert PathBuf & Path into Python pathlib.Path instead of PyString. #​4925
  • Relax parsing of exotic Python versions. #​4949
  • PyO3 threads now hang instead of pthread_exit trying to acquire the GIL when the interpreter is shutting down. This mimics the Python 3.14 behavior and avoids undefined behavior and crashes. #​4874
Removed
  • Remove implementations of Deref for PyAny and other "native" types. #​4593
  • Remove implicit default of trailing optional arguments (see #​2935) #​4729
  • Remove the deprecated implicit eq fallback for simple enums. #​4730
Fixed
  • Correct FFI definition of PyIter_Send to return a PySendResult. #​4746
  • Fix a thread safety issue in the runtime borrow checker used by mutable pyclass instances on the free-threaded build. #​4948

Configuration

📅 Schedule: Branch creation - "on saturday at 3pm" in timezone Asia/Tokyo, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

renovate bot and others added 2 commits December 28, 2025 00:10
- Replace Python::allow_threads with Python::detach
- Replace Python::with_gil with Python::attach
- Update FromPyObject impl for PyTokenProvider:
  - Change lifetime parameters from <'py> to <'a, 'py>
  - Replace extract_bound with extract
  - Change parameter from &Bound<'py, PyAny> to Borrowed<'a, 'py, PyAny>
  - Add Error associated type = PyErr

This fixes all compilation errors and deprecation warnings when upgrading PyO3 from 0.23 to 0.27.
@K-dash K-dash self-requested a review December 28, 2025 05:33
@codecov
Copy link

codecov bot commented Dec 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #104   +/-   ##
=======================================
  Coverage   87.33%   87.33%           
=======================================
  Files          41       41           
  Lines        5281     5281           
=======================================
  Hits         4612     4612           
  Misses        669      669           
Flag Coverage Δ
rust 87.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@K-dash K-dash merged commit 884ab74 into main Dec 28, 2025
17 checks passed
@K-dash K-dash deleted the renovate/pyo3-0.x branch December 28, 2025 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants