diff --git a/Cargo.lock b/Cargo.lock
index 20ca83a39..2427073b3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -288,8 +288,7 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "jiter"
version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed1be5dfeadf968b30fa03a012a2f161de8be6df2d91bd8085c62cfb5efca65a"
+source = "git+https://github.com/pydantic/jiter.git?branch=dh/pyo3-0.27#747950a735f0ae44f77cda4ea01f5c772ecea59e"
dependencies = [
"ahash",
"bitvec",
@@ -458,8 +457,7 @@ dependencies = [
[[package]]
name = "pyo3"
version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
+source = "git+https://github.com/pyo3/pyo3.git#da618c7c90b1f55c66c14353c9f014c9ae7c52df"
dependencies = [
"indoc",
"libc",
@@ -476,8 +474,7 @@ dependencies = [
[[package]]
name = "pyo3-build-config"
version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
+source = "git+https://github.com/pyo3/pyo3.git#da618c7c90b1f55c66c14353c9f014c9ae7c52df"
dependencies = [
"python3-dll-a",
"target-lexicon",
@@ -486,8 +483,7 @@ dependencies = [
[[package]]
name = "pyo3-ffi"
version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
+source = "git+https://github.com/pyo3/pyo3.git#da618c7c90b1f55c66c14353c9f014c9ae7c52df"
dependencies = [
"libc",
"pyo3-build-config",
@@ -496,8 +492,7 @@ dependencies = [
[[package]]
name = "pyo3-macros"
version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
+source = "git+https://github.com/pyo3/pyo3.git#da618c7c90b1f55c66c14353c9f014c9ae7c52df"
dependencies = [
"proc-macro2",
"pyo3-macros-backend",
@@ -508,8 +503,7 @@ dependencies = [
[[package]]
name = "pyo3-macros-backend"
version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
+source = "git+https://github.com/pyo3/pyo3.git#da618c7c90b1f55c66c14353c9f014c9ae7c52df"
dependencies = [
"heck",
"proc-macro2",
diff --git a/Cargo.toml b/Cargo.toml
index a2455c7aa..73936ab66 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -105,3 +105,8 @@ too_many_lines = "allow"
unnecessary_wraps = "allow"
unused_self = "allow"
used_underscore_binding = "allow"
+
+[patch.crates-io]
+pyo3 = { git = "https://github.com/pyo3/pyo3.git" }
+pyo3-build-config = { git = "https://github.com/pyo3/pyo3.git" }
+jiter = { git = "https://github.com/pydantic/jiter.git", branch = "dh/pyo3-0.27" }
diff --git a/src/build_tools.rs b/src/build_tools.rs
index 2abcbd9ca..a5fa284ed 100644
--- a/src/build_tools.rs
+++ b/src/build_tools.rs
@@ -5,7 +5,7 @@ use std::str::FromStr;
use pyo3::exceptions::PyException;
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyList, PyString};
-use pyo3::{intern, FromPyObject, PyErrArguments};
+use pyo3::{intern, PyErrArguments};
use crate::errors::{PyLineError, ValError};
use crate::input::InputType;
@@ -19,7 +19,7 @@ pub fn schema_or_config<'py, T>(
config_key: &Bound<'py, PyString>,
) -> PyResult