contrib/python-zstandard/c-ext/compressobj.c
changeset 30924 c32454d69b85
parent 30822 b54a2984cdd4
child 31799 e0dc40530c5a
equal deleted inserted replaced
30923:5b60464efbde 30924:c32454d69b85
    40 		PyErr_SetString(ZstdError, "cannot call compress() after compressor finished");
    40 		PyErr_SetString(ZstdError, "cannot call compress() after compressor finished");
    41 		return NULL;
    41 		return NULL;
    42 	}
    42 	}
    43 
    43 
    44 #if PY_MAJOR_VERSION >= 3
    44 #if PY_MAJOR_VERSION >= 3
    45 	if (!PyArg_ParseTuple(args, "y#", &source, &sourceSize)) {
    45 	if (!PyArg_ParseTuple(args, "y#:compress", &source, &sourceSize)) {
    46 #else
    46 #else
    47 	if (!PyArg_ParseTuple(args, "s#", &source, &sourceSize)) {
    47 	if (!PyArg_ParseTuple(args, "s#:compress", &source, &sourceSize)) {
    48 #endif
    48 #endif
    49 		return NULL;
    49 		return NULL;
    50 	}
    50 	}
    51 
    51 
    52 	input.src = source;
    52 	input.src = source;
    96 	int flushMode = compressorobj_flush_finish;
    96 	int flushMode = compressorobj_flush_finish;
    97 	size_t zresult;
    97 	size_t zresult;
    98 	PyObject* result = NULL;
    98 	PyObject* result = NULL;
    99 	Py_ssize_t resultSize = 0;
    99 	Py_ssize_t resultSize = 0;
   100 
   100 
   101 	if (!PyArg_ParseTuple(args, "|i", &flushMode)) {
   101 	if (!PyArg_ParseTuple(args, "|i:flush", &flushMode)) {
   102 		return NULL;
   102 		return NULL;
   103 	}
   103 	}
   104 
   104 
   105 	if (flushMode != compressorobj_flush_finish && flushMode != compressorobj_flush_block) {
   105 	if (flushMode != compressorobj_flush_finish && flushMode != compressorobj_flush_block) {
   106 		PyErr_SetString(PyExc_ValueError, "flush mode not recognized");
   106 		PyErr_SetString(PyExc_ValueError, "flush mode not recognized");