Skip to content

Commit 0029871

Browse files
committed
Add patch for tokenizers-0.19+
1 parent b677c1c commit 0029871

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

graalpython/lib-graalpython/patches/tokenizers/metadata.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[[rules]]
2+
version = '>= 0.19'
3+
patch = 'tokenizers-0.19-plus.patch'
4+
license = 'Apache-2.0'
5+
16
[[rules]]
27
version = '== 0.13.3'
38
patch = 'tokenizers-0.13.3.patch'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs
2+
index 3f1e713..6dd3c72 100644
3+
--- a/bindings/python/src/lib.rs
4+
+++ b/bindings/python/src/lib.rs
5+
@@ -50,14 +50,16 @@ extern "C" fn child_after_fork() {
6+
pub fn tokenizers(m: &Bound<'_, PyModule>) -> PyResult<()> {
7+
let _ = env_logger::try_init_from_env("TOKENIZERS_LOG");
8+
9+
+ // GraalPy change: Disable the atfork warning. This triggers a ton of false positives when
10+
+ // jline calls stty and we don't support fork anyway
11+
// Register the fork callback
12+
- #[cfg(target_family = "unix")]
13+
- unsafe {
14+
- if !REGISTERED_FORK_CALLBACK {
15+
- libc::pthread_atfork(None, None, Some(child_after_fork));
16+
- REGISTERED_FORK_CALLBACK = true;
17+
- }
18+
- }
19+
+ // #[cfg(target_family = "unix")]
20+
+ // unsafe {
21+
+ // if !REGISTERED_FORK_CALLBACK {
22+
+ // libc::pthread_atfork(None, None, Some(child_after_fork));
23+
+ // REGISTERED_FORK_CALLBACK = true;
24+
+ // }
25+
+ // }
26+
27+
m.add_class::<tokenizer::PyTokenizer>()?;
28+
m.add_class::<tokenizer::PyAddedToken>()?;

0 commit comments

Comments
 (0)