-
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.
[GR-57317] Update and clean up patches, part #2
PullRequest: graalpython/3455
- Loading branch information
Showing
11 changed files
with
170 additions
and
31 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
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
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
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
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' |
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
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,12 @@ | ||
diff --git a/setup.py b/setup.py | ||
index 7bd1be4..390c84c 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -13,6 +13,7 @@ from setuptools.command.build_ext import build_ext | ||
|
||
|
||
def get_version(version): | ||
+ return version | ||
if "PYPI_RELEASE" not in os.environ: | ||
today = datetime.date.today() | ||
version = f"{version}.dev{today.year}{today.month:02d}{today.day:02d}" |
2 changes: 2 additions & 0 deletions
2
graalpython/lib-graalpython/patches/safetensors/metadata.toml
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
[[rules]] | ||
# Recent versions should use pyo3 with upstream support for graalpy | ||
install-priority = 0 | ||
version = '== 0.3.3' | ||
patch = 'safetensors-0.3.3.patch' | ||
license = 'Apache-2.0' |
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
28 changes: 28 additions & 0 deletions
28
graalpython/lib-graalpython/patches/tokenizers/tokenizers-0.19-plus.patch
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,28 @@ | ||
diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs | ||
index 3f1e713..6dd3c72 100644 | ||
--- a/bindings/python/src/lib.rs | ||
+++ b/bindings/python/src/lib.rs | ||
@@ -50,14 +50,16 @@ extern "C" fn child_after_fork() { | ||
pub fn tokenizers(m: &Bound<'_, PyModule>) -> PyResult<()> { | ||
let _ = env_logger::try_init_from_env("TOKENIZERS_LOG"); | ||
|
||
+ // GraalPy change: Disable the atfork warning. This triggers a ton of false positives when | ||
+ // jline calls stty and we don't support fork anyway | ||
// Register the fork callback | ||
- #[cfg(target_family = "unix")] | ||
- unsafe { | ||
- if !REGISTERED_FORK_CALLBACK { | ||
- libc::pthread_atfork(None, None, Some(child_after_fork)); | ||
- REGISTERED_FORK_CALLBACK = true; | ||
- } | ||
- } | ||
+ // #[cfg(target_family = "unix")] | ||
+ // unsafe { | ||
+ // if !REGISTERED_FORK_CALLBACK { | ||
+ // libc::pthread_atfork(None, None, Some(child_after_fork)); | ||
+ // REGISTERED_FORK_CALLBACK = true; | ||
+ // } | ||
+ // } | ||
|
||
m.add_class::<tokenizer::PyTokenizer>()?; | ||
m.add_class::<tokenizer::PyAddedToken>()?; |