Skip to content

Commit 975e867

Browse files
authored
Fix python 314 compat (#520)
Fix python 3.14 build compat 1. `pyo3` depend updated to `0.26`: this is required or else it can't be compiled for python 3.14 2. version update to `1.1.11-dev0` ``` # removed Fix compat with Rustc 1.86.0 3. change rust conditions that was throwing `unstable` `errors` in `rustc 1.86.0 (05f9846f8 2025-03-31)` (fairly new version, not the latest) _ ``` @hoytak @seanses @assafvayner
1 parent 6fbde98 commit 975e867

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

hf_xet/Cargo.lock

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

hf_xet/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pprof = { version = "0.14", features = [
2727
"prost",
2828
"protobuf-codec",
2929
], optional = true }
30-
pyo3 = { version = "0.23", features = [
30+
pyo3 = { version = "0.26", features = [
3131
"extension-module",
3232
"abi3-py37",
3333
"auto-initialize",

hf_xet/src/progress_update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl WrappedProgressUpdaterImpl {
151151
// increment.
152152
//
153153
// Run on compute thread that doesn't block async workers
154-
Python::with_gil(|py| {
154+
Python::attach(|py| {
155155
let func = py_func.bind(py);
156156

157157
// Test if it's enabled first; if None is passed in, then this is disabled.
@@ -223,7 +223,7 @@ impl WrappedProgressUpdaterImpl {
223223
async fn register_updates_impl(self: Arc<Self>, updates: ProgressUpdate) -> PyResult<()> {
224224
// Run on compute thread that doesn't block async workers
225225
tokio::task::spawn_blocking(move || {
226-
Python::with_gil(|py| {
226+
Python::attach(|py| {
227227
let f = self.py_func.bind(py);
228228

229229
if self.update_with_detailed_progress {

hf_xet/src/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ where
197197
F::Output: Into<PyResult<Out>> + Send + Sync,
198198
Out: Send + Sync + 'static,
199199
{
200-
let result: PyResult<Out> = py.allow_threads(move || {
200+
let result: PyResult<Out> = py.detach(move || {
201201
// Now, without the GIL, spawn the task on a new OS thread. This avoids having tokio cache stuff in
202202
// thread-local storage that is invalidated after a fork-exec.
203203
spawn_os_thread(move || {

hf_xet/src/token_refresh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl WrappedTokenRefresher {
3333

3434
/// Validate that the inputted python object is callable
3535
fn validate_callable(py_func: &Py<PyAny>) -> Result<String, PyErr> {
36-
Python::with_gil(|py| {
36+
Python::attach(|py| {
3737
let f = py_func.bind(py);
3838
let name = f
3939
.repr()
@@ -52,7 +52,7 @@ impl WrappedTokenRefresher {
5252
#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))]
5353
impl TokenRefresher for WrappedTokenRefresher {
5454
async fn refresh(&self) -> Result<TokenInfo, AuthError> {
55-
Python::with_gil(|py| {
55+
Python::attach(|py| {
5656
let f = self.py_func.bind(py);
5757
if !f.is_callable() {
5858
return Err(AuthError::RefreshFunctionNotCallable(self.name.clone()));

0 commit comments

Comments
 (0)