Lines Matching refs:self

252 _bz2_BZ2Compressor_compress_impl(BZ2Compressor *self, Py_buffer *data)
257 ACQUIRE_LOCK(self);
258 if (self->flushed)
261 result = compress(self, data->buf, data->len, BZ_RUN);
262 RELEASE_LOCK(self);
277 _bz2_BZ2Compressor_flush_impl(BZ2Compressor *self)
282 ACQUIRE_LOCK(self);
283 if (self->flushed)
286 self->flushed = 1;
287 result = compress(self, NULL, 0, BZ_FINISH);
289 RELEASE_LOCK(self);
315 _bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel)
325 self->lock = PyThread_allocate_lock();
326 if (self->lock == NULL) {
331 self->bzs.opaque = NULL;
332 self->bzs.bzalloc = BZ2_Malloc;
333 self->bzs.bzfree = BZ2_Free;
334 bzerror = BZ2_bzCompressInit(&self->bzs, compresslevel, 0, 0);
341 PyThread_free_lock(self->lock);
342 self->lock = NULL;
358 _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
377 return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel);
384 BZ2Compressor_dealloc(BZ2Compressor *self)
386 BZ2_bzCompressEnd(&self->bzs);
387 if (self->lock != NULL) {
388 PyThread_free_lock(self->lock);
390 PyTypeObject *tp = Py_TYPE(self);
391 tp->tp_free((PyObject *)self);
396 BZ2Compressor_traverse(BZ2Compressor *self, visitproc visit, void *arg)
398 Py_VISIT(Py_TYPE(self));
612 produced, *self.needs_input* will be set to ``False``. In this case, the next
617 *self.needs_input* will be set to True.
625 _bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
631 ACQUIRE_LOCK(self);
632 if (self->eof)
635 result = decompress(self, data->buf, data->len, max_length);
636 RELEASE_LOCK(self);
643 _bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self)
652 if (self->lock != NULL) {
653 PyThread_free_lock(self->lock);
655 self->lock = lock;
657 self->needs_input = 1;
658 self->bzs_avail_in_real = 0;
659 self->input_buffer = NULL;
660 self->input_buffer_size = 0;
661 Py_XSETREF(self->unused_data, PyBytes_FromStringAndSize(NULL, 0));
662 if (self->unused_data == NULL)
665 bzerror = BZ2_bzDecompressInit(&self->bzs, 0, 0);
672 Py_CLEAR(self->unused_data);
673 PyThread_free_lock(self->lock);
674 self->lock = NULL;
679 _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
689 return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor *)self);
704 BZ2Decompressor_dealloc(BZ2Decompressor *self)
706 if(self->input_buffer != NULL) {
707 PyMem_Free(self->input_buffer);
709 BZ2_bzDecompressEnd(&self->bzs);
710 Py_CLEAR(self->unused_data);
711 if (self->lock != NULL) {
712 PyThread_free_lock(self->lock);
715 PyTypeObject *tp = Py_TYPE(self);
716 tp->tp_free((PyObject *)self);
721 BZ2Decompressor_traverse(BZ2Decompressor *self, visitproc visit, void *arg)
723 Py_VISIT(Py_TYPE(self));