Lines Matching refs:self
535 def cleanup(self):
536 name = ensure_legal_c_identifier(self.name)
608 _lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data)
613 ACQUIRE_LOCK(self);
614 if (self->flushed) {
618 result = compress(self, data->buf, data->len, LZMA_RUN);
620 RELEASE_LOCK(self);
635 _lzma_LZMACompressor_flush_impl(Compressor *self)
640 ACQUIRE_LOCK(self);
641 if (self->flushed) {
644 self->flushed = 1;
645 result = compress(self, NULL, 0, LZMA_FINISH);
647 RELEASE_LOCK(self);
769 Compressor_init(Compressor *self, PyObject *args, PyObject *kwargs)
777 _lzma_state *state = PyType_GetModuleState(Py_TYPE(self));
804 self->alloc.opaque = NULL;
805 self->alloc.alloc = PyLzma_Malloc;
806 self->alloc.free = PyLzma_Free;
807 self->lzs.allocator = &self->alloc;
809 self->lock = PyThread_allocate_lock();
810 if (self->lock == NULL) {
815 self->flushed = 0;
821 if (Compressor_init_xz(state, &self->lzs, check, preset, filterspecs) != 0) {
827 if (Compressor_init_alone(state, &self->lzs, preset, filterspecs) != 0) {
833 if (Compressor_init_raw(state, &self->lzs, filterspecs) != 0) {
844 PyThread_free_lock(self->lock);
845 self->lock = NULL;
850 Compressor_dealloc(Compressor *self)
852 lzma_end(&self->lzs);
853 if (self->lock != NULL) {
854 PyThread_free_lock(self->lock);
856 PyTypeObject *tp = Py_TYPE(self);
857 tp->tp_free((PyObject *)self);
868 Compressor_traverse(Compressor *self, visitproc visit, void *arg)
870 Py_VISIT(Py_TYPE(self));
1120 produced, *self.needs_input* will be set to ``False``. In this case, the next
1125 *self.needs_input* will be set to True.
1133 _lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data,
1139 ACQUIRE_LOCK(self);
1140 if (self->eof)
1143 result = decompress(self, data->buf, data->len, max_length);
1144 RELEASE_LOCK(self);
1193 _lzma_LZMADecompressor___init___impl(Decompressor *self, int format,
1200 _lzma_state *state = PyType_GetModuleState(Py_TYPE(self));
1225 self->alloc.opaque = NULL;
1226 self->alloc.alloc = PyLzma_Malloc;
1227 self->alloc.free = PyLzma_Free;
1228 self->lzs.allocator = &self->alloc;
1229 self->lzs.next_in = NULL;
1236 if (self->lock != NULL) {
1237 PyThread_free_lock(self->lock);
1239 self->lock = lock;
1241 self->check = LZMA_CHECK_UNKNOWN;
1242 self->needs_input = 1;
1243 self->input_buffer = NULL;
1244 self->input_buffer_size = 0;
1245 Py_XSETREF(self->unused_data, PyBytes_FromStringAndSize(NULL, 0));
1246 if (self->unused_data == NULL) {
1252 lzret = lzma_auto_decoder(&self->lzs, memlimit_, decoder_flags);
1259 lzret = lzma_stream_decoder(&self->lzs, memlimit_, decoder_flags);
1266 self->check = LZMA_CHECK_NONE;
1267 lzret = lzma_alone_decoder(&self->lzs, memlimit_);
1274 self->check = LZMA_CHECK_NONE;
1275 if (Decompressor_init_raw(state, &self->lzs, filters) == -1) {
1287 Py_CLEAR(self->unused_data);
1288 PyThread_free_lock(self->lock);
1289 self->lock = NULL;
1294 Decompressor_dealloc(Decompressor *self)
1296 if(self->input_buffer != NULL)
1297 PyMem_Free(self->input_buffer);
1299 lzma_end(&self->lzs);
1300 Py_CLEAR(self->unused_data);
1301 if (self->lock != NULL) {
1302 PyThread_free_lock(self->lock);
1304 PyTypeObject *tp = Py_TYPE(self);
1305 tp->tp_free((PyObject *)self);
1310 Decompressor_traverse(Decompressor *self, visitproc visit, void *arg)
1312 Py_VISIT(Py_TYPE(self));