self->pos++;
if (bzerror != BZ_OK || buf == end)
break;
- if (skipnextlf ) {
+ if (skipnextlf) {
skipnextlf = 0;
if (c == '\n') {
/* Seeing a \n here with
buffersize = bytesrequested;
if (buffersize > INT_MAX) {
PyErr_SetString(PyExc_OverflowError,
- "requested number of bytes is more than a Python string can hold");
+ "requested number of bytes is "
+ "more than a Python string can hold");
goto cleanup;
}
ret = PyString_FromStringAndSize((char *)NULL, buffersize);
default:
error = 1;
+ break;
}
if (error) {
- PyErr_SetString(PyExc_ValueError, "invalid mode");
+ PyErr_Format(PyExc_ValueError,
+ "invalid mode char %c", *mode);
return -1;
}
mode++;
- if (*mode == 0)
+ if (*mode == '\0')
break;
}
file_args = Py_BuildValue("(ssi)", name, mode, buffering);
if (!file_args)
- goto error;
+ return -1;
+
+ /* From now on, we have stuff to dealloc, so jump to error label
+ * instead of returning */
if (PyFile_Type.tp_init((PyObject *)self, file_args, NULL) < 0)
goto error;
0, NULL, NULL);
break;
}
+ Util_DropReadAhead(self);
((PyObject*)self)->ob_type->tp_free((PyObject *)self);
}
#endif
;
-statichere PyTypeObject BZ2File_Type = {
+static PyTypeObject BZ2File_Type = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"bz2.BZ2File", /*tp_name*/
ACQUIRE_LOCK(self);
if (!self->running) {
- PyErr_SetString(PyExc_ValueError, "this object was already "
- "flushed");
+ PyErr_SetString(PyExc_ValueError,
+ "this object was already flushed");
goto error;
}
}
static PyMethodDef BZ2Comp_methods[] = {
- {"compress", (PyCFunction)BZ2Comp_compress, METH_VARARGS, BZ2Comp_compress__doc__},
- {"flush", (PyCFunction)BZ2Comp_flush, METH_NOARGS, BZ2Comp_flush__doc__},
+ {"compress", (PyCFunction)BZ2Comp_compress, METH_VARARGS,
+ BZ2Comp_compress__doc__},
+ {"flush", (PyCFunction)BZ2Comp_flush, METH_NOARGS,
+ BZ2Comp_flush__doc__},
{NULL, NULL} /* sentinel */
};
must be a number between 1 and 9.\n\
");
-statichere PyTypeObject BZ2Comp_Type = {
+static PyTypeObject BZ2Comp_Type = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"bz2.BZ2Compressor", /*tp_name*/
decompress() function instead.\n\
");
-statichere PyTypeObject BZ2Decomp_Type = {
+static PyTypeObject BZ2Decomp_Type = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"bz2.BZ2Decompressor", /*tp_name*/