Skip to content

Commit db0ace3

Browse files
committed
Eliminate function for raising a value error
1 parent f59718e commit db0ace3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Modules/_zstd/compressor.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ class zstd_contentsize_converter(CConverter):
5555
[python start generated code]*/
5656
/*[python end generated code: output=da39a3ee5e6b4b0d input=0932c350d633c7de]*/
5757

58-
static inline int
59-
raise_wrong_contentsize(void)
60-
{
61-
PyErr_Format(PyExc_ValueError,
62-
"size argument should be a positive int less "
63-
"than %ull", ZSTD_CONTENTSIZE_ERROR);
64-
return 0;
65-
}
6658

6759
static int
6860
zstd_contentsize_converter(PyObject *size, unsigned long long *p)
@@ -81,13 +73,19 @@ zstd_contentsize_converter(PyObject *size, unsigned long long *p)
8173
if (pledged_size == (unsigned long long)-1 && PyErr_Occurred()) {
8274
*p = ZSTD_CONTENTSIZE_ERROR;
8375
if (PyErr_ExceptionMatches(PyExc_OverflowError)) {
84-
return raise_wrong_contentsize();
76+
PyErr_Format(PyExc_ValueError,
77+
"size argument should be a positive int less "
78+
"than %ull", ZSTD_CONTENTSIZE_ERROR);
79+
return 0;
8580
}
8681
return 0;
8782
}
8883
if (pledged_size >= ZSTD_CONTENTSIZE_ERROR) {
8984
*p = ZSTD_CONTENTSIZE_ERROR;
90-
return raise_wrong_contentsize();
85+
PyErr_Format(PyExc_ValueError,
86+
"size argument should be a positive int less "
87+
"than %ull", ZSTD_CONTENTSIZE_ERROR);
88+
return 0;
9189
}
9290
*p = pledged_size;
9391
}

0 commit comments

Comments
 (0)