Skip to content

Commit 7eaffaf

Browse files
Add lz4version function to return the lz4 C library version
1 parent ed10272 commit 7eaffaf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/python-lz4.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ static PyObject *py_lz4_uncompress(PyObject *self, PyObject *args) {
159159
return result;
160160
}
161161

162+
static PyObject *py_lz4_versionnumber(PyObject *self, PyObject *args) {
163+
return Py_BuildValue("i", LZ4_versionNumber());
164+
}
165+
162166
static PyMethodDef Lz4Methods[] = {
163167
{"LZ4_compress_fast", py_lz4_compress_fast, METH_VARARGS, COMPRESSFAST_DOCSTRING},
164168
{"LZ4_compress", py_lz4_compress, METH_VARARGS, COMPRESS_DOCSTRING},
@@ -170,6 +174,7 @@ static PyMethodDef Lz4Methods[] = {
170174
{"decompress", py_lz4_uncompress, METH_VARARGS, UNCOMPRESS_DOCSTRING},
171175
{"dumps", py_lz4_compress, METH_VARARGS, COMPRESS_DOCSTRING},
172176
{"loads", py_lz4_uncompress, METH_VARARGS, UNCOMPRESS_DOCSTRING},
177+
{"lz4version", py_lz4_versionnumber, METH_VARARGS, "Returns the version number of the lz4 C library"},
173178
{NULL, NULL, 0, NULL}
174179
};
175180

0 commit comments

Comments
 (0)