Skip to content

Commit dda7d7d

Browse files
convex-renovate-runner[bot]Convex, Inc.
authored andcommitted
Update pyo3 dependencies to 0.27 (#39657)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [pyo3](https://redirect.github.com/pyo3/pyo3) | dependencies | minor | `0.24` -> `0.27` | | [pyo3](https://redirect.github.com/pyo3/pyo3) | workspace.dependencies | minor | `0.24` -> `0.27` | | [pyo3-async-runtimes](https://redirect.github.com/PyO3/pyo3-async-runtimes) | dependencies | minor | `0.24` -> `0.27` | | [pyo3-async-runtimes](https://redirect.github.com/PyO3/pyo3-async-runtimes) | workspace.dependencies | minor | `0.24` -> `0.27` | | [pyo3-build-config](https://redirect.github.com/pyo3/pyo3) | build-dependencies | minor | `0.24` -> `0.27` | | [pyo3-build-config](https://redirect.github.com/pyo3/pyo3) | workspace.dependencies | minor | `0.24` -> `0.27` | --- ### Release Notes <details> <summary>pyo3/pyo3 (pyo3)</summary> ### [`v0.27.1`](https://redirect.github.com/pyo3/pyo3/blob/HEAD/CHANGELOG.md#0271---2025-10-21) [Compare Source](https://redirect.github.com/pyo3/pyo3/compare/v0.27.0...v0.27.1) ##### Fixed - Fix `clippy:declare_interior_mutable_const` warning from `#[pyfunction]`. [#&#8203;5538](https://redirect.github.com/PyO3/pyo3/pull/5538) - Expose `pyo3::types::PySendResult` in public API. [#&#8203;5539](https://redirect.github.com/PyO3/pyo3/pull/5539) ### [`v0.27.0`](https://redirect.github.com/pyo3/pyo3/blob/HEAD/CHANGELOG.md#0270---2025-10-19) [Compare Source](https://redirect.github.com/pyo3/pyo3/compare/v0.26.0...v0.27.0) ##### Packaging - Extend range of supported versions of `hashbrown` optional dependency to include version 0.16. [#&#8203;5428](https://redirect.github.com/PyO3/pyo3/pull/5428) - Bump optional `num-bigint` dependency minimum version to 0.4.4. [#&#8203;5471](https://redirect.github.com/PyO3/pyo3/pull/5471) - Test against Python 3.14 final release. [#&#8203;5499](https://redirect.github.com/PyO3/pyo3/pull/5499) - Drop support for PyPy 3.9 and 3.10. [#&#8203;5516](https://redirect.github.com/PyO3/pyo3/pull/5516) - Provide a better error message when building an outdated PyO3 for a too-new Python version. [#&#8203;5519](https://redirect.github.com/PyO3/pyo3/pull/5519) ##### Added - Add `FromPyObjectOwned` as convenient trait bound for `FromPyObject` when the data is not borrowed from Python. [#&#8203;4390](https://redirect.github.com/PyO3/pyo3/pull/4390) - Add `Borrowed::extract`, same as `PyAnyMethods::extract`, but does not restrict the lifetime by deref. [#&#8203;4390](https://redirect.github.com/PyO3/pyo3/pull/4390) - `experimental-inspect`: basic support for `#[derive(IntoPyObject)]` (no struct fields support yet). [#&#8203;5365](https://redirect.github.com/PyO3/pyo3/pull/5365) - `experimental-inspect`: support `#[pyo3(get, set)]` and `#[pyclass(get_all, set_all)]`. [#&#8203;5370](https://redirect.github.com/PyO3/pyo3/pull/5370) - Add `PyTypeCheck::classinfo_object` that returns an object that can be used as parameter in `isinstance` or `issubclass`. [#&#8203;5387](https://redirect.github.com/PyO3/pyo3/pull/5387) - Implement `PyTypeInfo` on `datetime.*` types even when the limited API is enabled. [#&#8203;5388](https://redirect.github.com/PyO3/pyo3/pull/5388) - Implement `PyTypeInfo` on `PyIterator`, `PyMapping` and `PySequence`. [#&#8203;5402](https://redirect.github.com/PyO3/pyo3/pull/5402) - Implement `PyTypeInfo` on `PyCode` when using the stable ABI. [#&#8203;5403](https://redirect.github.com/PyO3/pyo3/pull/5403) - Implement `PyTypeInfo` on `PyWeakrefReference` when using the stable ABI. [#&#8203;5404](https://redirect.github.com/PyO3/pyo3/pull/5404) - Add `pyo3::sync::RwLockExt` trait, analogous to `pyo3::sync::MutexExt` for readwrite locks. [#&#8203;5435](https://redirect.github.com/PyO3/pyo3/pull/5435) - Add `PyString::from_bytes`. [#&#8203;5437](https://redirect.github.com/PyO3/pyo3/pull/5437) - Implement `AsRef<[u8]>` for `PyBytes`. [#&#8203;5445](https://redirect.github.com/PyO3/pyo3/pull/5445) - Add `CastError` and `CastIntoError`. [#&#8203;5468](https://redirect.github.com/PyO3/pyo3/pull/5468) - Add `PyCapsuleMethods::pointer_checked` and `PyCapsuleMethods::is_valid_checked`. [#&#8203;5474](https://redirect.github.com/PyO3/pyo3/pull/5474) - Add `Borrowed::cast`, `Borrowed::cast_exact` and `Borrowed::cast_unchecked`. [#&#8203;5475](https://redirect.github.com/PyO3/pyo3/pull/5475) - Add conversions for `jiff::civil::ISOWeekDate`. [#&#8203;5478](https://redirect.github.com/PyO3/pyo3/pull/5478) - Add conversions for `&Cstr`, `Cstring` and `Cow<Cstr>`. [#&#8203;5482](https://redirect.github.com/PyO3/pyo3/pull/5482) - add `#[pyclass(skip_from_py_object)]` option, to opt-out of the `FromPyObject: PyClass + Clone` blanket impl. [#&#8203;5488](https://redirect.github.com/PyO3/pyo3/pull/5488) - Add `PyErr::add_note`. [#&#8203;5489](https://redirect.github.com/PyO3/pyo3/pull/5489) - Add `FromPyObject` impl for `Cow<Path>` & `Cow<OsStr>`. [#&#8203;5497](https://redirect.github.com/PyO3/pyo3/pull/5497) - Add `#[pyclass(from_py_object)]` pyclass option, to opt-in to the extraction of pyclasses by value (requires `Clone`). [#&#8203;5506](https://redirect.github.com/PyO3/pyo3/pull/5506) ##### Changed - Rework `FromPyObject` trait for flexibility and performance: [#&#8203;4390](https://redirect.github.com/PyO3/pyo3/pull/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`. [#&#8203;5244](https://redirect.github.com/PyO3/pyo3/pull/5244) - Deprecate `#[pyfn]` attribute. [#&#8203;5384](https://redirect.github.com/PyO3/pyo3/pull/5384) - Fetch type name dynamically on cast errors instead of using `PyTypeCheck::NAME`. [#&#8203;5387](https://redirect.github.com/PyO3/pyo3/pull/5387) - Deprecate `PyTypeCheck::NAME` in favour of `PyTypeCheck::classinfo_object` which provides the type information at runtime. [#&#8203;5387](https://redirect.github.com/PyO3/pyo3/pull/5387) - `PyClassGuard(Mut)` and `PyRef(Mut)` extraction now returns an opaque Rust error [#&#8203;5413](https://redirect.github.com/PyO3/pyo3/pull/5413) - Fetch type name dynamically when exporting types implementing `PyTypeInfo` with `#[pymodule_use]`. [#&#8203;5414](https://redirect.github.com/PyO3/pyo3/pull/5414) - Improve `Debug` representation of `PyBuffer<T>`. [#&#8203;5442](https://redirect.github.com/PyO3/pyo3/pull/5442) - `experimental-inspect`: change the way introspection data is emitted in the binaries to avoid a pointer indirection and simplify parsing. [#&#8203;5450](https://redirect.github.com/PyO3/pyo3/pull/5450) - Optimize `Py<T>::drop` for the case when attached to the Python interpreter. [#&#8203;5454](https://redirect.github.com/PyO3/pyo3/pull/5454) - Replace `DowncastError` and `DowncastIntoError` with `CastError` and `CastIntoError`. [#&#8203;5468](https://redirect.github.com/PyO3/pyo3/pull/5468) - Enable fast-path for 128-bit integer conversions on `GraalPy`. [#&#8203;5471](https://redirect.github.com/PyO3/pyo3/pull/5471) - Deprecate `PyAnyMethods::downcast` functions in favour of `Bound::cast` functions. [#&#8203;5472](https://redirect.github.com/PyO3/pyo3/pull/5472) - Make `PyTypeCheck` an `unsafe trait`. [#&#8203;5473](https://redirect.github.com/PyO3/pyo3/pull/5473) - Deprecate unchecked `PyCapsuleMethods`: `pointer()`, `reference()`, and `is_valid()`. [#&#8203;5474](https://redirect.github.com/PyO3/pyo3/pull/5474) - Reduce lifetime of return value in `PyCapsuleMethods::reference`. [#&#8203;5474](https://redirect.github.com/PyO3/pyo3/pull/5474) - `PyCapsuleMethods::name` now returns `CapsuleName` wrapper instead of `&CStr`. [#&#8203;5474](https://redirect.github.com/PyO3/pyo3/pull/5474) - Deprecate `import_exception_bound` in favour of `import_exception`. [#&#8203;5480](https://redirect.github.com/PyO3/pyo3/pull/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. [#&#8203;5494](https://redirect.github.com/PyO3/pyo3/pull/5494) - Allow converting naive datetime into chrono `DateTime<Local>`. [#&#8203;5507](https://redirect.github.com/PyO3/pyo3/pull/5507) ##### Removed - Removed `FromPyObjectBound` trait. [#&#8203;4390](https://redirect.github.com/PyO3/pyo3/pull/4390) ##### Fixed - Fix compilation failure on `wasm32-wasip2`. [#&#8203;5368](https://redirect.github.com/PyO3/pyo3/pull/5368) - Fix `OsStr` conversion for non-utf8 strings on Windows. [#&#8203;5444](https://redirect.github.com/PyO3/pyo3/pull/5444) - Fix issue with `cargo vendor` caused by gitignored build artifact `emscripten/pybuilddir.txt`. [#&#8203;5456](https://redirect.github.com/PyO3/pyo3/pull/5456) - Stop leaking `PyMethodDef` instances inside `#[pyfunction]` macro generated code. [#&#8203;5459](https://redirect.github.com/PyO3/pyo3/pull/5459) - Don't export definition of FFI struct `PyObjectObFlagsAndRefcnt` on 32-bit Python 3.14 (doesn't exist). [#&#8203;5499](https://redirect.github.com/PyO3/pyo3/pull/5499) - Fix failure to build for `abi3` interpreters on Windows using maturin's built-in sysconfig in combination with the `generate-import-lib` feature. [#&#8203;5503](https://redirect.github.com/PyO3/pyo3/pull/5503) - Fix FFI definitions `PyModule_ExecDef` and `PyModule_FromDefAndSpec2` on PyPy. [#&#8203;5529](https://redirect.github.com/PyO3/pyo3/pull/5529) ### [`v0.26.0`](https://redirect.github.com/pyo3/pyo3/blob/HEAD/CHANGELOG.md#0260---2025-08-29) [Compare Source](https://redirect.github.com/pyo3/pyo3/compare/v0.25.1...v0.26.0) ##### Packaging - Bump hashbrown dependency to 0.15. [#&#8203;5152](https://redirect.github.com/PyO3/pyo3/pull/5152) - Update MSRV to 1.74. [#&#8203;5171](https://redirect.github.com/PyO3/pyo3/pull/5171) - Set the same maximum supported version for alternative interpreters as for CPython. [#&#8203;5192](https://redirect.github.com/PyO3/pyo3/pull/5192) - Add optional `bytes` dependency to add conversions for `bytes::Bytes`. [#&#8203;5252](https://redirect.github.com/PyO3/pyo3/pull/5252) - Publish new crate `pyo3-introspection` to pair with the `experimental-inspect` feature. [#&#8203;5300](https://redirect.github.com/PyO3/pyo3/pull/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. [#&#8203;5343](https://redirect.github.com/PyO3/pyo3/pull/5343) ##### Added - Add `#[pyo3(warn(message = "...", category = ...))]` attribute for automatic warnings generation for `#[pyfunction]` and `#[pymethods]`. [#&#8203;4364](https://redirect.github.com/PyO3/pyo3/pull/4364) - Add `PyMutex`, available on Python 3.13 and newer. [#&#8203;4523](https://redirect.github.com/PyO3/pyo3/pull/4523) - Add FFI definition `PyMutex_IsLocked`, available on Python 3.14 and newer. [#&#8203;4523](https://redirect.github.com/PyO3/pyo3/pull/4523) - Add `PyString::from_encoded_object`. [#&#8203;5017](https://redirect.github.com/PyO3/pyo3/pull/5017) - `experimental-inspect`: add basic input type annotations. [#&#8203;5089](https://redirect.github.com/PyO3/pyo3/pull/5089) - Add FFI function definitions for `PyFrameObject` from CPython 3.13. [#&#8203;5154](https://redirect.github.com/PyO3/pyo3/pull/5154) - `experimental-inspect`: tag modules created using `#[pymodule]` or `#[pymodule_init]` functions as incomplete. [#&#8203;5207](https://redirect.github.com/PyO3/pyo3/pull/5207) - `experimental-inspect`: add basic return type support. [#&#8203;5208](https://redirect.github.com/PyO3/pyo3/pull/5208) - Add `PyCode::compile` and `PyCodeMethods::run` to create and execute code objects. [#&#8203;5217](https://redirect.github.com/PyO3/pyo3/pull/5217) - Add `PyOnceLock` type for thread-safe single-initialization. [#&#8203;5223](https://redirect.github.com/PyO3/pyo3/pull/5223) - Add `PyClassGuard(Mut)` pyclass holders. In the future they will replace `PyRef(Mut)`. [#&#8203;5233](https://redirect.github.com/PyO3/pyo3/pull/5233) - `experimental-inspect`: allow annotations in `#[pyo3(signature)]` signature attribute. [#&#8203;5241](https://redirect.github.com/PyO3/pyo3/pull/5241) - Implement `MutexExt` for parking_lot's/lock_api `ReentrantMutex`. [#&#8203;5258](https://redirect.github.com/PyO3/pyo3/pull/5258) - `experimental-inspect`: support class associated constants. [#&#8203;5272](https://redirect.github.com/PyO3/pyo3/pull/5272) - Add `Bound::cast` family of functions superseding the `PyAnyMethods::downcast` family. [#&#8203;5289](https://redirect.github.com/PyO3/pyo3/pull/5289) - Add FFI definitions `Py_Version` and `Py_IsFinalizing`. [#&#8203;5317](https://redirect.github.com/PyO3/pyo3/pull/5317) - `experimental-inspect`: add output type annotation for `#[pyclass]`. [#&#8203;5320](https://redirect.github.com/PyO3/pyo3/pull/5320) - `experimental-inspect`: support `#[pyclass(eq, eq_int, ord, hash, str)]`. [#&#8203;5338](https://redirect.github.com/PyO3/pyo3/pull/5338) - `experimental-inspect`: add basic support for `#[derive(FromPyObject)]` (no struct fields support yet). [#&#8203;5339](https://redirect.github.com/PyO3/pyo3/pull/5339) - Add `Python::try_attach`. [#&#8203;5342](https://redirect.github.com/PyO3/pyo3/pull/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. [#&#8203;4568](https://redirect.github.com/PyO3/pyo3/pull/4568) - `PyModule::from_code` now defaults `file_name` to `<string>` if empty. [#&#8203;4777](https://redirect.github.com/PyO3/pyo3/pull/4777) - Deprecate `PyString::from_object` in favour of `PyString::from_encoded_object`. [#&#8203;5017](https://redirect.github.com/PyO3/pyo3/pull/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. [#&#8203;5144](https://redirect.github.com/PyO3/pyo3/pull/5144) - Change `is_instance_of` trait bound from `PyTypeInfo` to `PyTypeCheck`. [#&#8203;5146](https://redirect.github.com/PyO3/pyo3/pull/5146) - Many PyO3 proc macros now report multiple errors instead of only the first one. [#&#8203;5159](https://redirect.github.com/PyO3/pyo3/pull/5159) - Change `MutexExt` return type to be an associated type. [#&#8203;5201](https://redirect.github.com/PyO3/pyo3/pull/5201) - Use `PyCallArgs` for `Py::call` and friends so they're equivalent to their `Bound` counterpart. [#&#8203;5206](https://redirect.github.com/PyO3/pyo3/pull/5206) - Rename `Python::with_gil` to `Python::attach`. [#&#8203;5209](https://redirect.github.com/PyO3/pyo3/pull/5209) - Rename `Python::allow_threads` to `Python::detach` [#&#8203;5221](https://redirect.github.com/PyO3/pyo3/pull/5221) - Deprecate `GILOnceCell` type in favour of `PyOnceLock`. [#&#8203;5223](https://redirect.github.com/PyO3/pyo3/pull/5223) - Rename `pyo3::prepare_freethreaded_python` to `Python::initialize`. [#&#8203;5247](https://redirect.github.com/PyO3/pyo3/pull/5247) - Convert `PyMemoryError` into/from `io::ErrorKind::OutOfMemory`. [#&#8203;5256](https://redirect.github.com/PyO3/pyo3/pull/5256) - Deprecate `GILProtected`. [#&#8203;5285](https://redirect.github.com/PyO3/pyo3/pull/5285) - Move `#[pyclass]` docstring formatting from import time to compile time. [#&#8203;5286](https://redirect.github.com/PyO3/pyo3/pull/5286) - `Python::attach` will now panic if the Python interpreter is in the process of shutting down. [#&#8203;5317](https://redirect.github.com/PyO3/pyo3/pull/5317) - Add fast-path to `PyTypeInfo::type_object` for `#[pyclass]` types. [#&#8203;5324](https://redirect.github.com/PyO3/pyo3/pull/5324) - Deprecate `PyObject` type alias for `Py<PyAny>`. [#&#8203;5325](https://redirect.github.com/PyO3/pyo3/pull/5325) - Rename `Python::with_gil_unchecked` to `Python::attach_unchecked`. [#&#8203;5340](https://redirect.github.com/PyO3/pyo3/pull/5340) - Rename `Python::assume_gil_acquired` to `Python::assume_attached`. [#&#8203;5354](https://redirect.github.com/PyO3/pyo3/pull/5354) ##### Removed - Remove FFI definition of internals of `PyFrameObject`. [#&#8203;5154](https://redirect.github.com/PyO3/pyo3/pull/5154) - Remove `Eq` and `PartialEq` implementations on `PyGetSetDef` FFI definition. [#&#8203;5196](https://redirect.github.com/PyO3/pyo3/pull/5196) - Remove private FFI definitions `_Py_IsCoreInitialized` and `_Py_InitializeMain`. [#&#8203;5317](https://redirect.github.com/PyO3/pyo3/pull/5317) ##### Fixed - Use critical section in `PyByteArray::to_vec` on freethreaded build to replicate GIL-enabled "soundness". [#&#8203;4742](https://redirect.github.com/PyO3/pyo3/pull/4742) - Fix precision loss when converting `bigdecimal` into Python. [#&#8203;5198](https://redirect.github.com/PyO3/pyo3/pull/5198) - Don't treat win7 target as a cross-compilation. [#&#8203;5210](https://redirect.github.com/PyO3/pyo3/pull/5210) - WASM targets no longer require exception handling support for Python < 3.14. [#&#8203;5239](https://redirect.github.com/PyO3/pyo3/pull/5239) - Fix segfault when dropping `PyBuffer<T>` after the Python interpreter has been finalized. [#&#8203;5242](https://redirect.github.com/PyO3/pyo3/pull/5242) - `experimental-inspect`: better automated imports generation. [#&#8203;5251](https://redirect.github.com/PyO3/pyo3/pull/5251) - `experimental-inspect`: fix introspection of `__richcmp__`, `__concat__`, `__repeat__`, `__inplace_concat__` and `__inplace_repeat__`. [#&#8203;5273](https://redirect.github.com/PyO3/pyo3/pull/5273) - fixed a leaked borrow, when converting a mutable sub class into a frozen base class using `PyRef::into_super` [#&#8203;5281](https://redirect.github.com/PyO3/pyo3/pull/5281) - Fix FFI definition `Py_Exit` (never returns, was `()` return value, now `!`). [#&#8203;5317](https://redirect.github.com/PyO3/pyo3/pull/5317) - `experimental-inspect`: fix handling of module members gated behind `#[cfg(...)]` attributes. [#&#8203;5318](https://redirect.github.com/PyO3/pyo3/pull/5318) ### [`v0.25.1`](https://redirect.github.com/pyo3/pyo3/blob/HEAD/CHANGELOG.md#0251---2025-06-12) [Compare Source](https://redirect.github.com/pyo3/pyo3/compare/v0.25.0...v0.25.1) ##### Packaging - Add support for Windows on ARM64. [#&#8203;5145](https://redirect.github.com/PyO3/pyo3/pull/5145) - Add `chrono-local` feature for optional conversions for chrono's `Local` timezone & `DateTime<Local>` instances. [#&#8203;5174](https://redirect.github.com/PyO3/pyo3/pull/5174) ##### Added - Add FFI definition `PyBytes_AS_STRING`. [#&#8203;5121](https://redirect.github.com/PyO3/pyo3/pull/5121) - Add support for module associated consts introspection. [#&#8203;5150](https://redirect.github.com/PyO3/pyo3/pull/5150) ##### Changed - Enable "vectorcall" FFI definitions on GraalPy. [#&#8203;5121](https://redirect.github.com/PyO3/pyo3/pull/5121) - Use `Py_Is` function on GraalPy [#&#8203;5121](https://redirect.github.com/PyO3/pyo3/pull/5121) ##### Fixed - Report a better compile error for `async` declarations when not using `experimental-async` feature. [#&#8203;5156](https://redirect.github.com/PyO3/pyo3/pull/5156) - Fix implementation of `FromPyObject` for `uuid::Uuid` on big-endian architectures. [#&#8203;5161](https://redirect.github.com/PyO3/pyo3/pull/5161) - Fix segmentation faults on 32-bit x86 with Python 3.14. [#&#8203;5180](https://redirect.github.com/PyO3/pyo3/pull/5180) ### [`v0.25.0`](https://redirect.github.com/pyo3/pyo3/blob/HEAD/CHANGELOG.md#0250---2025-05-14) [Compare Source](https://redirect.github.com/pyo3/pyo3/compare/v0.24.2...v0.25.0) ##### Packaging - Support Python 3.14.0b1. [#&#8203;4811](https://redirect.github.com/PyO3/pyo3/pull/4811) - Bump supported GraalPy version to 24.2. [#&#8203;5116](https://redirect.github.com/PyO3/pyo3/pull/5116) - Add optional `bigdecimal` dependency to add conversions for `bigdecimal::BigDecimal`. [#&#8203;5011](https://redirect.github.com/PyO3/pyo3/pull/5011) - Add optional `time` dependency to add conversions for `time` types. [#&#8203;5057](https://redirect.github.com/PyO3/pyo3/pull/5057) - Remove `cfg-if` dependency. [#&#8203;5110](https://redirect.github.com/PyO3/pyo3/pull/5110) - Add optional `ordered_float` dependency to add conversions for `ordered_float::NotNan` and `ordered_float::OrderedFloat`. [#&#8203;5114](https://redirect.github.com/PyO3/pyo3/pull/5114) ##### Added - Add initial type stub generation to the `experimental-inspect` feature. [#&#8203;3977](https://redirect.github.com/PyO3/pyo3/pull/3977) - Add `#[pyclass(generic)]` option to support runtime generic typing. [#&#8203;4926](https://redirect.github.com/PyO3/pyo3/pull/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. [#&#8203;5044](https://redirect.github.com/PyO3/pyo3/pull/5044) - Implement `From`/`Into` for `Borrowed<T>` -> `Py<T>`. [#&#8203;5054](https://redirect.github.com/PyO3/pyo3/pull/5054) - Add `PyTzInfo` constructors. [#&#8203;5055](https://redirect.github.com/PyO3/pyo3/pull/5055) - Add FFI definition `PY_INVALID_STACK_EFFECT`. [#&#8203;5064](https://redirect.github.com/PyO3/pyo3/pull/5064) - Implement `AsRef<Py<PyAny>>` for `Py<T>`, `Bound<T>` and `Borrowed<T>`. [#&#8203;5071](https://redirect.github.com/PyO3/pyo3/pull/5071) - Add FFI definition `PyModule_Add` and `compat::PyModule_Add`. [#&#8203;5085](https://redirect.github.com/PyO3/pyo3/pull/5085) - Add FFI definitions `Py_HashBuffer`, `Py_HashPointer`, and `PyObject_GenericHash`. [#&#8203;5086](https://redirect.github.com/PyO3/pyo3/pull/5086) - Support `#[pymodule_export]` on `const` items in declarative modules. [#&#8203;5096](https://redirect.github.com/PyO3/pyo3/pull/5096) - Add `#[pyclass(immutable_type)]` option (on Python 3.14+ with `abi3`, or 3.10+ otherwise) for immutable type objects. [#&#8203;5101](https://redirect.github.com/PyO3/pyo3/pull/5101) - Support `#[pyo3(rename_all)]` support on `#[derive(IntoPyObject)]`. [#&#8203;5112](https://redirect.github.com/PyO3/pyo3/pull/5112) - Add `PyRange` wrapper. [#&#8203;5117](https://redirect.github.com/PyO3/pyo3/pull/5117) ##### Changed - Enable use of `datetime` types with `abi3` feature enabled. [#&#8203;4970](https://redirect.github.com/PyO3/pyo3/pull/4970) - Deprecate `timezone_utc` in favor of `PyTzInfo::utc`. [#&#8203;5055](https://redirect.github.com/PyO3/pyo3/pull/5055) - Reduce visibility of some CPython implementation details: [#&#8203;5064](https://redirect.github.com/PyO3/pyo3/pull/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>`. [#&#8203;5071](https://redirect.github.com/PyO3/pyo3/pull/5071) - Change `Py::is` to take `other: &Py<T>`. [#&#8203;5071](https://redirect.github.com/PyO3/pyo3/pull/5071) - Change `PyVisit::call` to take `T: Into<Option<&Py<T>>>`. [#&#8203;5071](https://redirect.github.com/PyO3/pyo3/pull/5071) - Expose `PyDateTime_DATE_GET_TZINFO` and `PyDateTime_TIME_GET_TZINFO` on PyPy 3.10 and later. [#&#8203;5079](https://redirect.github.com/PyO3/pyo3/pull/5079) - Add `#[track_caller]` to `with_gil` and `with_gil_unchecked`. [#&#8203;5109](https://redirect.github.com/PyO3/pyo3/pull/5109) - Use `std::thread::park()` instead of `libc::pause()` or `sleep(9999999)`. [#&#8203;5115](https://redirect.github.com/PyO3/pyo3/pull/5115) ##### Removed - Remove all functionality deprecated in PyO3 0.23. [#&#8203;4982](https://redirect.github.com/PyO3/pyo3/pull/4982) - Remove deprecated `IntoPy` and `ToPyObject` traits. [#&#8203;5010](https://redirect.github.com/PyO3/pyo3/pull/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`. [#&#8203;5064](https://redirect.github.com/PyO3/pyo3/pull/5064) - Remove FFI definition `PyCode_GetNumFree` (PyO3 cannot support it due to knowledge of the code object). [#&#8203;5064](https://redirect.github.com/PyO3/pyo3/pull/5064) - Remove `AsPyPointer` trait. [#&#8203;5071](https://redirect.github.com/PyO3/pyo3/pull/5071) - Remove support for the deprecated string form of `from_py_with`. [#&#8203;5097](https://redirect.github.com/PyO3/pyo3/pull/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`. [#&#8203;5105](https://redirect.github.com/PyO3/pyo3/pull/5105) - Remove FFI definitions `PyASCIIObjectState`, `PyUnicode_IS_ASCII`, `PyUnicode_IS_COMPACT`, and `PyUnicode_IS_COMPACT_ASCII` on Python 3.14 and newer. [#&#8203;5133](https://redirect.github.com/PyO3/pyo3/pull/5133) ##### Fixed - Correctly pick up the shared state for conda-based Python installation when reading information from sysconfigdata. [#&#8203;5037](https://redirect.github.com/PyO3/pyo3/pull/5037) - Fix compile failure with `#[derive(IntoPyObject, FromPyObject)]` when using `#[pyo3()]` options recognised by only one of the two derives. [#&#8203;5070](https://redirect.github.com/PyO3/pyo3/pull/5070) - Fix various compile errors from missing FFI definitions using certain feature combinations on PyPy and GraalPy. [#&#8203;5091](https://redirect.github.com/PyO3/pyo3/pull/5091) - Fallback on `backports.zoneinfo` for python <3.9 when converting timezones into python. [#&#8203;5120](https://redirect.github.com/PyO3/pyo3/pull/5120) </details> <details> <summary>PyO3/pyo3-async-runtimes (pyo3-async-runtimes)</summary> ### [`v0.27.0`](https://redirect.github.com/PyO3/pyo3-async-runtimes/blob/HEAD/CHANGELOG.md#0270---2025-10-20) [Compare Source](https://redirect.github.com/PyO3/pyo3-async-runtimes/compare/v0.26.0...v0.27.0) - Avoid attaching to the runtime when cloning TaskLocals by using std::sync::Arc. [#&#8203;62](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/62) - **Breaking**: Finalize the future without holding GIL inside async-std/tokio runtime. Trait `Runtime` now requires `spawn_blocking` function, `future_into_py` functions now require future return type to be `Send`. [#&#8203;60](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/60) - Change pyo3 `downcast` calls to `cast` calls [#&#8203;65](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/65) - Use `pyo3::intern!` for method calls and `getattr` calls [#&#8203;66](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/66) - Fix missing LICENSE file in macros crate by [@&#8203;musicinmybrain](https://redirect.github.com/musicinmybrain) in [https://github.com/PyO3/pyo3-async-runtimes/pull/63](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/63) - Bump to pyo3 0.27. [#&#8203;68](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/68) ### [`v0.26.0`](https://redirect.github.com/PyO3/pyo3-async-runtimes/blob/HEAD/CHANGELOG.md#0260---2025-09-02) [Compare Source](https://redirect.github.com/PyO3/pyo3-async-runtimes/compare/v0.25.0...v0.26.0) - Bump to pyo3 0.26. [#&#8203;54](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/54) ### [`v0.25.0`](https://redirect.github.com/PyO3/pyo3-async-runtimes/blob/HEAD/CHANGELOG.md#0250---2025-05-14) [Compare Source](https://redirect.github.com/PyO3/pyo3-async-runtimes/compare/v0.24.0...v0.25.0) - Bump to pyo3 0.25. [#&#8203;41](https://redirect.github.com/PyO3/pyo3-async-runtimes/pull/41) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on the first day of the month" in timezone America/Los_Angeles, 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 these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). GitOrigin-RevId: 5a0ef1c4a53b56fb982c6b8d87545a2c12615477
1 parent c860713 commit dda7d7d

File tree

5 files changed

+48
-46
lines changed

5 files changed

+48
-46
lines changed

Cargo.lock

Lines changed: 14 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ rustls-tls-webpki-roots = [ "convex/rustls-tls-webpki-roots" ]
1919
convex = { version = "=0.10.2", default-features = false }
2020
futures = { version = "0.3" }
2121
parking_lot = { version = "0.12" }
22-
pyo3 = { features = [ "abi3", "abi3-py39" ], version = "0.24" }
23-
pyo3-async-runtimes = { version = "0.24", features = [ "tokio-runtime" ] }
22+
pyo3 = { features = [ "abi3", "abi3-py39" ], version = "0.27" }
23+
pyo3-async-runtimes = { version = "0.27", features = [ "tokio-runtime" ] }
2424
tokio = { features = [ "full" ], version = "1" }
2525
tracing = { version = "0.1" }
2626
tracing-subscriber = { features = [ "env-filter" ], version = "0.3.17" }
2727

2828
[build-dependencies]
29-
pyo3-build-config = { version = "0.24" }
29+
pyo3-build-config = { version = "0.27" }
3030

3131
[dev-dependencies]
3232
convex = { version = "=0.10.2", default-features = false, features = [ "testing" ] }

src/client/mod.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ use crate::{
5959
/// A wrapper type that can accept a Python `Dict[str, CoercibleToConvexValue]`
6060
#[derive(Default)]
6161
pub struct FunctionArgsWrapper(BTreeMap<String, Value>);
62-
impl<'py> FromPyObject<'py> for FunctionArgsWrapper {
63-
fn extract_bound(d: &Bound<'py, PyAny>) -> PyResult<Self> {
64-
let map = d
65-
.downcast::<PyDict>()?
62+
impl<'a, 'py> FromPyObject<'a, 'py> for FunctionArgsWrapper {
63+
type Error = PyErr;
64+
65+
// const INPUT_TYPE: &str = "dict[str, CoercibleToConvexValue]";
66+
67+
fn extract(obj: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
68+
let map = obj
69+
.cast::<PyDict>()?
6670
.iter()
6771
.map(|(key, value)| {
6872
let k = key.extract::<String>()?;
@@ -78,7 +82,7 @@ impl<'py> FromPyObject<'py> for FunctionArgsWrapper {
7882
async fn check_python_signals_periodically() -> PyErr {
7983
loop {
8084
sleep(Duration::from_secs(1)).await;
81-
if let Err(e) = Python::with_gil(|py| py.check_signals()) {
85+
if let Err(e) = Python::attach(|py| py.check_signals()) {
8286
return e;
8387
}
8488
}
@@ -96,7 +100,7 @@ impl PyConvexClient {
96100
&mut self,
97101
py: Python<'_>,
98102
result: FunctionResult,
99-
) -> PyResult<PyObject> {
103+
) -> PyResult<Py<PyAny>> {
100104
match result {
101105
FunctionResult::Value(v) => Ok(value_to_py_wrapped(py, v)),
102106
FunctionResult::ErrorMessage(e) => Err(PyException::new_err(e)),
@@ -179,7 +183,7 @@ impl PyConvexClient {
179183
py: Python<'_>,
180184
name: &str,
181185
args: Option<FunctionArgsWrapper>,
182-
) -> PyResult<PyObject> {
186+
) -> PyResult<Py<PyAny>> {
183187
let args: BTreeMap<String, Value> = args.unwrap_or_default().0;
184188
let res = self.block_on_and_check_signals(|client| client.query(name, args))?;
185189
self.function_result_to_py_result(py, res)
@@ -193,7 +197,7 @@ impl PyConvexClient {
193197
py: Python<'_>,
194198
name: &str,
195199
args: Option<FunctionArgsWrapper>,
196-
) -> PyResult<PyObject> {
200+
) -> PyResult<Py<PyAny>> {
197201
let args: BTreeMap<String, Value> = args.unwrap_or_default().0;
198202
let res = self.block_on_and_check_signals(|client| client.mutation(name, args))?;
199203
self.function_result_to_py_result(py, res)
@@ -207,7 +211,7 @@ impl PyConvexClient {
207211
py: Python<'_>,
208212
name: &str,
209213
args: Option<FunctionArgsWrapper>,
210-
) -> PyResult<PyObject> {
214+
) -> PyResult<Py<PyAny>> {
211215
let args: BTreeMap<String, Value> = args.unwrap_or_default().0;
212216
let res = self.block_on_and_check_signals(|client| client.action(name, args))?;
213217
self.function_result_to_py_result(py, res)
@@ -295,7 +299,7 @@ fn init_logging() {
295299

296300
// Exposed for testing
297301
#[pyfunction]
298-
fn py_to_rust_to_py(py: Python<'_>, py_val: Bound<'_, PyAny>) -> PyResult<PyObject> {
302+
fn py_to_rust_to_py(py: Python<'_>, py_val: Bound<'_, PyAny>) -> PyResult<Py<PyAny>> {
299303
// this is just a map
300304
match py_to_value(py_val.as_borrowed()) {
301305
Ok(val) => Ok(value_to_py(py, val)),

src/query_result.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ use pyo3::{
1616
PyString,
1717
},
1818
Borrowed,
19+
Py,
1920
PyAny,
20-
PyObject,
2121
PyResult,
2222
Python,
2323
};
2424

2525
// TODO using an enum would be cleaner here
26-
pub fn value_to_py_wrapped(py: Python<'_>, v: convex::Value) -> PyObject {
26+
pub fn value_to_py_wrapped(py: Python<'_>, v: convex::Value) -> Py<PyAny> {
2727
let py_dict = PyDict::new(py);
2828
py_dict
2929
.set_item("type", PyString::new(py, "value"))
@@ -32,7 +32,7 @@ pub fn value_to_py_wrapped(py: Python<'_>, v: convex::Value) -> PyObject {
3232
py_dict.into()
3333
}
3434

35-
pub fn convex_error_to_py_wrapped(py: Python<'_>, err: ConvexError) -> PyObject {
35+
pub fn convex_error_to_py_wrapped(py: Python<'_>, err: ConvexError) -> Py<PyAny> {
3636
let py_dict = PyDict::new(py);
3737
py_dict
3838
.set_item("type", PyString::new(py, "convexerror"))
@@ -42,7 +42,7 @@ pub fn convex_error_to_py_wrapped(py: Python<'_>, err: ConvexError) -> PyObject
4242
py_dict.into()
4343
}
4444

45-
pub fn value_to_py(py: Python<'_>, v: convex::Value) -> PyObject {
45+
pub fn value_to_py(py: Python<'_>, v: convex::Value) -> Py<PyAny> {
4646
match v {
4747
convex::Value::Null => py.None(),
4848
convex::Value::Int64(val) => {
@@ -52,7 +52,7 @@ pub fn value_to_py(py: Python<'_>, v: convex::Value) -> PyObject {
5252
let int_64_class = int64_module
5353
.getattr("ConvexInt64")
5454
.expect("Couldn't import ConvexInt64 from _convex.int64");
55-
let obj: PyObject = int_64_class
55+
let obj: Py<PyAny> = int_64_class
5656
.call((val,), None)
5757
.unwrap_or_else(|_| panic!("Couldn't construct ConvexInt64() from {val:?}"))
5858
.into();
@@ -117,16 +117,16 @@ pub fn py_to_value(py_val: Borrowed<'_, '_, PyAny>) -> PyResult<convex::Value> {
117117
return Ok(convex::Value::Bytes(val));
118118
}
119119
if py_val.is_instance_of::<PyList>() {
120-
let py_list = py_val.downcast::<PyList>()?;
120+
let py_list = py_val.cast::<PyList>()?;
121121
let mut vec: Vec<convex::Value> = Vec::new();
122-
for item in py_list {
122+
for item in py_list.iter() {
123123
let inner_value: convex::Value = py_to_value(item.as_borrowed())?;
124124
vec.push(inner_value);
125125
}
126126
return Ok(convex::Value::Array(vec));
127127
}
128128
if py_val.is_instance_of::<PyDict>() {
129-
let py_dict = py_val.downcast::<PyDict>()?;
129+
let py_dict = py_val.cast::<PyDict>()?;
130130
let mut map: BTreeMap<String, convex::Value> = BTreeMap::new();
131131
for (key, value) in py_dict.iter() {
132132
let inner_value: convex::Value = py_to_value(value.as_borrowed())?;

src/subscription.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl PySubscriberId {
9292
async fn check_python_signals_periodically() -> PyErr {
9393
loop {
9494
sleep(Duration::from_secs(1)).await;
95-
if let Err(e) = Python::with_gil(|py| py.check_signals()) {
95+
if let Err(e) = Python::attach(|py| py.check_signals()) {
9696
return e;
9797
}
9898
}
@@ -119,7 +119,7 @@ impl PyQuerySubscription {
119119
self.inner.lock().take();
120120
}
121121

122-
fn next(&self, py: Python) -> PyResult<PyObject> {
122+
fn next(&self, py: Python) -> PyResult<Py<PyAny>> {
123123
let query_sub = self.inner.clone();
124124
let res = self.rt_handle.block_on(async {
125125
tokio::select!(
@@ -148,7 +148,7 @@ impl PyQuerySubscription {
148148
}
149149
}
150150

151-
fn anext(&self, py: Python<'_>) -> PyResult<PyObject> {
151+
fn anext(&self, py: Python<'_>) -> PyResult<Py<PyAny>> {
152152
let query_sub = self.inner.clone();
153153
let fut = pyo3_async_runtimes::tokio::future_into_py(py, async move {
154154
let query_sub_inner = query_sub.lock().take();
@@ -158,7 +158,7 @@ impl PyQuerySubscription {
158158
let mut query_sub_inner = query_sub_inner.unwrap();
159159
let res = query_sub_inner.next().await;
160160
let _ = query_sub.lock().insert(query_sub_inner);
161-
Python::with_gil(|py| match res.unwrap() {
161+
Python::attach(|py| match res.unwrap() {
162162
FunctionResult::Value(v) => Ok(value_to_py_wrapped(py, v)),
163163
FunctionResult::ErrorMessage(e) => Err(PyException::new_err(e)),
164164
FunctionResult::ConvexError(v) => {
@@ -194,7 +194,7 @@ impl PyQuerySetSubscription {
194194
self.inner.lock().is_some()
195195
}
196196

197-
fn next(&self, py: Python) -> PyResult<PyObject> {
197+
fn next(&self, py: Python) -> PyResult<Py<PyAny>> {
198198
let query_sub = self.inner.clone();
199199
let res = self.rt_handle.as_ref().unwrap().block_on(async {
200200
tokio::select!(
@@ -219,7 +219,7 @@ impl PyQuerySetSubscription {
219219
}
220220
let py_sub_id: PySubscriberId = (*sub_id).into();
221221

222-
let sub_value: PyObject = match function_result.unwrap() {
222+
let sub_value: Py<PyAny> = match function_result.unwrap() {
223223
FunctionResult::Value(v) => value_to_py_wrapped(py, v.clone()),
224224
FunctionResult::ErrorMessage(e) => {
225225
// TODO this is wrong!
@@ -241,7 +241,7 @@ impl PyQuerySetSubscription {
241241
Ok(py_dict.into_any().unbind())
242242
}
243243

244-
fn anext(&self, py: Python<'_>) -> PyResult<PyObject> {
244+
fn anext(&self, py: Python<'_>) -> PyResult<Py<PyAny>> {
245245
let query_sub = self.inner.clone();
246246
let fut = pyo3_async_runtimes::tokio::future_into_py(py, async move {
247247
let query_sub_inner = query_sub.lock().take();
@@ -252,15 +252,15 @@ impl PyQuerySetSubscription {
252252
let res = query_sub_inner.next().await;
253253
let _ = query_sub.lock().insert(query_sub_inner);
254254

255-
Python::with_gil(|py| -> PyResult<PyObject> {
255+
Python::attach(|py| -> PyResult<Py<PyAny>> {
256256
let query_results = res.unwrap();
257257
let py_dict = PyDict::new(py);
258258
for (sub_id, function_result) in query_results.iter() {
259259
if function_result.is_none() {
260260
continue;
261261
}
262262
let py_sub_id: PySubscriberId = (*sub_id).into();
263-
let sub_value: PyObject = match function_result.unwrap() {
263+
let sub_value: Py<PyAny> = match function_result.unwrap() {
264264
FunctionResult::Value(v) => value_to_py(py, v.clone()),
265265
// TODO: this conflates errors with genuine values
266266
FunctionResult::ErrorMessage(e) => {

0 commit comments

Comments
 (0)