@@ -208,8 +208,17 @@ 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( not( PyPy ) , not( GraalPy ) ) ) ]
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+ ) ) ]
212218unsafe fn pystring_ascii_new < ' py > ( py : Python < ' py > , s : & str ) -> Bound < ' py , PyString > {
219+ // disabled on everything except tier-1 platforms because of a crash in the built wheels from CI,
220+ // see https://github.com/pydantic/jiter/pull/175
221+
213222 let ptr = pyo3:: ffi:: PyUnicode_New ( s. len ( ) as isize , 127 ) ;
214223 // see https://github.com/pydantic/jiter/pull/72#discussion_r1545485907
215224 debug_assert_eq ! ( pyo3:: ffi:: PyUnicode_KIND ( ptr) , pyo3:: ffi:: PyUnicode_1BYTE_KIND ) ;
@@ -219,8 +228,14 @@ unsafe fn pystring_ascii_new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyStri
219228 Bound :: from_owned_ptr ( py, ptr) . downcast_into_unchecked ( )
220229}
221230
222- // ffi::PyUnicode_DATA seems to be broken for pypy, hence this, marked as unsafe to avoid warnings
223- #[ cfg( any( PyPy , GraalPy ) ) ]
231+ // 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+ ) ) ) ]
224239unsafe fn pystring_ascii_new < ' py > ( py : Python < ' py > , s : & str ) -> Bound < ' py , PyString > {
225- PyString :: new_bound ( py, s)
240+ PyString :: new ( py, s)
226241}
0 commit comments