-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #418
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/crates/jiter/src/py_string_cache.rs b/crates/jiter/src/py_string_cache.rs | ||
index 96dcf66..21e6979 100644 | ||
--- a/crates/jiter/src/py_string_cache.rs | ||
+++ b/crates/jiter/src/py_string_cache.rs | ||
@@ -200,7 +200,7 @@ pub fn pystring_fast_new<'py>(py: Python<'py>, s: &str, ascii_only: bool) -> Bou | ||
|
||
/// Faster creation of PyString from an ASCII string, inspired by | ||
/// https://github.com/ijl/orjson/blob/3.10.0/src/str/create.rs#L41 | ||
-#[cfg(not(PyPy))] | ||
+#[cfg(all(not(PyPy), not(GraalPy)))] | ||
unsafe fn pystring_ascii_new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString> { | ||
let ptr = pyo3::ffi::PyUnicode_New(s.len() as isize, 127); | ||
// see https://github.com/pydantic/jiter/pull/72#discussion_r1545485907 | ||
@@ -212,7 +212,7 @@ unsafe fn pystring_ascii_new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyStri | ||
} | ||
|
||
// ffi::PyUnicode_DATA seems to be broken for pypy, hence this, marked as unsafe to avoid warnings | ||
-#[cfg(PyPy)] | ||
+#[cfg(any(PyPy, GraalPy))] | ||
unsafe fn pystring_ascii_new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString> { | ||
PyString::new_bound(py, s) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[[rules]] | ||
patch = 'jiter.patch' | ||
license = 'MIT' |