@@ -209,8 +209,8 @@ _zstd__train_dict_impl(PyObject *module, PyBytesObject *samples_bytes,
209209
210210 chunks_number = Py_SIZE (samples_size_list );
211211 if ((size_t ) chunks_number > UINT32_MAX ) {
212- PyErr_SetString (PyExc_ValueError ,
213- "The number of samples should <= UINT32_MAX." );
212+ PyErr_Format (PyExc_ValueError ,
213+ "The number of samples should be <= %u." , UINT32_MAX );
214214 return NULL ;
215215 }
216216
@@ -227,9 +227,9 @@ _zstd__train_dict_impl(PyObject *module, PyBytesObject *samples_bytes,
227227 chunk_sizes [i ] = PyLong_AsSize_t (size );
228228 Py_DECREF (size );
229229 if (chunk_sizes [i ] == (size_t )-1 && PyErr_Occurred ()) {
230- PyErr_SetString (PyExc_ValueError ,
230+ PyErr_Format (PyExc_ValueError ,
231231 "Items in samples_size_list should be an int "
232- "object, with a size_t value." );
232+ "object, with a value between 0 and %u." , SIZE_MAX );
233233 goto error ;
234234 }
235235 sizes_sum += chunk_sizes [i ];
@@ -327,8 +327,8 @@ _zstd__finalize_dict_impl(PyObject *module, PyBytesObject *custom_dict_bytes,
327327
328328 chunks_number = Py_SIZE (samples_size_list );
329329 if ((size_t ) chunks_number > UINT32_MAX ) {
330- PyErr_SetString (PyExc_ValueError ,
331- "The number of samples should <= UINT32_MAX." );
330+ PyErr_Format (PyExc_ValueError ,
331+ "The number of samples should be <= %u." , UINT32_MAX );
332332 return NULL ;
333333 }
334334
@@ -344,9 +344,9 @@ _zstd__finalize_dict_impl(PyObject *module, PyBytesObject *custom_dict_bytes,
344344 PyObject * size = PyList_GET_ITEM (samples_size_list , i );
345345 chunk_sizes [i ] = PyLong_AsSize_t (size );
346346 if (chunk_sizes [i ] == (size_t )-1 && PyErr_Occurred ()) {
347- PyErr_SetString (PyExc_ValueError ,
347+ PyErr_Format (PyExc_ValueError ,
348348 "Items in samples_size_list should be an int "
349- "object, with a size_t value." );
349+ "object, with a value between 0 and %u." , SIZE_MAX );
350350 goto error ;
351351 }
352352 sizes_sum += chunk_sizes [i ];
0 commit comments