Skip to content

Commit 4d4b450

Browse files
committed
Support the free-threaded build
1 parent eedc856 commit 4d4b450

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.github/workflows/build_wheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
# cibuildwheel builds linux wheels inside a manylinux container
1818
# it also takes care of procuring the correct python version for us
1919
os: [ubuntu-latest, windows-latest, macos-latest]
20-
python-version: [39, 310, 311, 312, 313]
20+
python-version: [39, 310, 311, 312, 313, 313t, 314, 314t]
2121

2222
steps:
2323
- uses: actions/checkout@v4
2424

25-
- uses: pypa/cibuildwheel@v2.22.0
25+
- uses: pypa/cibuildwheel@v3.1.4
2626
env:
2727
CIBW_BUILD: "cp${{ matrix.python-version}}-*"
2828

@@ -39,7 +39,7 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
os: [ubuntu-24.04-arm]
42-
python-version: [39, 310, 311, 312, 313]
42+
python-version: [39, 310, 311, 312, 313, 313t, 314, 314t]
4343

4444
steps:
4545
- uses: actions/checkout@v4

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl std::error::Error for EncodeError {}
187187

188188
const MAX_NUM_THREADS: usize = 128;
189189

190-
#[cfg_attr(feature = "python", pyclass)]
190+
#[cfg_attr(feature = "python", pyclass(frozen))]
191191
#[derive(Clone)]
192192
pub struct CoreBPE {
193193
encoder: HashMap<Vec<u8>, Rank>,

src/py.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl CoreBPE {
183183
}
184184
}
185185

186-
#[pyclass]
186+
#[pyclass(frozen)]
187187
struct TiktokenBuffer {
188188
tokens: Vec<Rank>,
189189
}
@@ -248,7 +248,7 @@ impl TiktokenBuffer {
248248
}
249249
}
250250

251-
#[pymodule]
251+
#[pymodule(gil_used = false)]
252252
fn _tiktoken(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
253253
m.add_class::<CoreBPE>()?;
254254
Ok(())

0 commit comments

Comments
 (0)