(&self, args: DecompressArgs, vm: &VirtualMachine)
| 73 | impl BZ2Decompressor { |
| 74 | #[pymethod] |
| 75 | fn decompress(&self, args: DecompressArgs, vm: &VirtualMachine) -> PyResult<Vec<u8>> { |
| 76 | let max_length = args.max_length(); |
| 77 | let data = &*args.data(); |
| 78 | |
| 79 | let mut state = self.state.lock(); |
| 80 | state |
| 81 | .decompress(data, max_length, BUFSIZ, vm) |
| 82 | .map_err(|e| match e { |
| 83 | DecompressError::Decompress(err) => vm.new_os_error(err.to_string()), |
| 84 | DecompressError::Eof(err) => err.to_pyexception(vm), |
| 85 | }) |
| 86 | } |
| 87 | |
| 88 | #[pygetset] |
| 89 | fn eof(&self) -> bool { |