add python 3.15 support - #176
Open
abraaoz wants to merge 3 commits into
Open
Conversation
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 free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds CPython 3.15 to the supported versions. Unlike the 3.14 PR (#159), the CI matrix alone is not enough:
pyo30.25.1 refuses the interpreter outright (the configured Python interpreter version (3.15) is newer than), andPYO3_USE_ABI3_FORWARD_COMPATIBILITY=1does not help, it gets past the version check and then fails to compile (the trait bound PyTime: PyTypeInfo is not satisfied, 4 errors). So this bumpspyo30.25.1 -> 0.29 and migrates the code with it.Migrations applied, all from PyO3's own migration guide
Python::with_gil->Python::attach.downcast*()->.cast*()GILOnceCell->PyOnceLockFromPyObject<'py>->FromPyObject<'_, 'py>withtype Errorandextract(Borrowed<..>)pyo3::PyObject->Py<PyAny>(alias deprecated)conversion::FromPyObjectBound->FromPyObjectTaskLocals::clone_ref->cloneTwo that are not renames:
rustdriver_future'sTgainsSend + 'static, whichpyo3_async_runtimes::tokio::future_into_pynow requires.extract::<T>()on a#[pyclass]returnsPyClassGuardError, whichRustPSQLDriverErrorcannot absorb. Converted viaPyErrat the two macro sites, sinceRustPSQLDriverError::RustPyErroralready carries#[from] pyo3::PyErr.Verified
Built and installed against CPython 3.15.0rc2 on macOS arm64, then imported:
Your
prekhooks pass locally on Rust 1.98.0, which is whatubuntu-latestcurrently ships, read from their exit codes:cargo fmt --checkwith your config,cargo clippy -p psqlpy -- -W clippy::all -W clippy::pedantic -D warnings, andcargo check, all 0.The test suite runs, on 3.15.0rc2, against a real PostgreSQL: 259 passed, 13 failed. All 13 are
test_ssl_mode.py, on a server withssl = off. They are not a regression: the releasedpsqlpy==0.12.1on 3.14 fails the same 13 against the same server.Not verified, and worth saying
test_binary_copy.pydid not run. It needspyarrow, which publishes nocp315wheel and whose source build wants Arrow C++; that is a test-dependency gap in 3.15's ecosystem, not something this branch touches.The SSL tests were not exercised against a TLS-enabled server, only shown to fail identically with and without this change.
One lint that is new, not broken
Clippy 1.98 adds
clippy::unused_async_trait_impl, split out ofunused_async, and pyo3 0.29 expands async#[pymethods]as trait impls, so it fires on four functions that already carry#[allow(clippy::unused_async)]. The new name was added beside the old one rather than restructuring those functions intoimpl Future, since theasyncthere is your choice about the Python-facing API.One unrelated line
src/statement/query.rs:53hadformat!("${}", &counter), which current clippy rejects as a redundant reference. It is not part of this migration and I did not otherwise touch that file, but the hook lints the whole crate, so the branch cannot go green without it. Dropped toformat!("${counter}").Two things for you to decide
pyo3-async-runtimesnow points at the released crate (0.29) instead of your fork'spsqlpybranch. The fork is pinned to the old pyo3 line and does not build against 0.29; upstream has since published 0.29.0. I do not know what your fork carries that upstream does not, so if that branch holds a patch you need, this dependency line should be rebased instead of replaced. That is your call, not mine.All 20
#[pyclass]types opted IN to theFromPyObjectderive. PyO3 0.29 makes that derive opt-in for#[pyclass]types implementingClone, andprekruns clippy with-D warnings, so the deprecation is a hard failure rather than a note. Every one of them gotfrom_py_object, which keeps today's behaviour exactly;skip_from_py_objectwould have removed those conversions from your public API, which is not a migration PR's call to make.