Skip to content

Commit 4479a67

Browse files
V4.3.1: Fix PyUnicode_FromFormat - use snprintf for float formatting
1 parent 343f179 commit 4479a67

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Crayon_Colab_Notebook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
XERV CRAYON V4.3.0 - Production Omni-Backend Tokenizer
2+
XERV CRAYON V4.3.1 - Production Omni-Backend Tokenizer
33
=======================================================
44
Copy this ENTIRE script into a Google Colab cell and run it.
55
@@ -13,7 +13,7 @@
1313
import time
1414

1515
print("=" * 70)
16-
print("XERV CRAYON V4.3.0 INSTALLATION")
16+
print("XERV CRAYON V4.3.1 INSTALLATION")
1717
print("=" * 70)
1818

1919
# 1. Environment Check

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "xerv-crayon"
7-
version = "4.3.0"
7+
version = "4.3.1"
88
description = "Omni-Backend Tokenizer - CPU (AVX2/512), CUDA (NVIDIA), ROCm (AMD) with automatic hardware detection"
99
readme = "README.md"
1010
requires-python = ">=3.10"

src/crayon/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
from __future__ import annotations
4747

48-
__version__ = "4.3.0"
48+
__version__ = "4.3.1"
4949
__author__ = "Xerv Research Engineering Division"
5050

5151
# ============================================================================

src/crayon/c_ext/gpu_engine_cuda.cu

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ static PyObject* load_gpu(PyObject* self, PyObject* args) {
266266
trie_size = sz;
267267
engine_loaded = true;
268268

269-
// Return success info
270-
return PyUnicode_FromFormat("Loaded %u entries (%.2f MB) to GPU",
271-
sz, (array_bytes * 3) / (1024.0 * 1024.0));
269+
// Return success info (use snprintf because PyUnicode_FromFormat doesn't support %f)
270+
char msg[256];
271+
snprintf(msg, sizeof(msg), "Loaded %u entries (%.2f MB) to GPU",
272+
sz, (array_bytes * 3) / (1024.0 * 1024.0));
273+
return PyUnicode_FromString(msg);
272274
}
273275

274276
// --- BATCH TOKENIZATION ---

0 commit comments

Comments
 (0)