Skip to content

Commit 0744102

Browse files
authored
restore pystring_ascii_new fast path, using PyO3 0.23.3 (#180)
1 parent 06aa3a5 commit 0744102

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

crates/jiter/src/py_string_cache.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,7 @@ pub fn pystring_fast_new<'py>(py: Python<'py>, s: &str, ascii_only: bool) -> Bou
208208

209209
/// Faster creation of PyString from an ASCII string, inspired by
210210
/// https://github.com/ijl/orjson/blob/3.10.0/src/str/create.rs#L41
211-
#[cfg(all(
212-
any(
213-
all(target_arch = "x86_64", target_os = "linux"),
214-
all(target_arch = "aarch64", target_os = "macos"),
215-
),
216-
not(any(PyPy, GraalPy))
217-
))]
211+
#[cfg(not(any(PyPy, GraalPy)))]
218212
unsafe fn pystring_ascii_new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString> {
219213
// disabled on everything except tier-1 platforms because of a crash in the built wheels from CI,
220214
// see https://github.com/pydantic/jiter/pull/175
@@ -229,13 +223,7 @@ unsafe fn pystring_ascii_new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyStri
229223
}
230224

231225
// unoptimized version (albeit not that much slower) on other platforms
232-
#[cfg(not(all(
233-
any(
234-
all(target_arch = "x86_64", target_os = "linux"),
235-
all(target_arch = "aarch64", target_os = "macos"),
236-
),
237-
not(any(PyPy, GraalPy)),
238-
)))]
226+
#[cfg(any(PyPy, GraalPy))]
239227
unsafe fn pystring_ascii_new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString> {
240228
PyString::new(py, s)
241229
}

0 commit comments

Comments
 (0)