Skip to content

Commit 48b08a2

Browse files
committed
Revert "Split out common compression routines into separate file (#5728)"
This reverts commit 9c88475.
1 parent 9c88475 commit 48b08a2

File tree

5 files changed

+285
-286
lines changed

5 files changed

+285
-286
lines changed

stdlib/src/compression/bz2.rs renamed to stdlib/src/bz2.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ pub(crate) use _bz2::make_module;
44

55
#[pymodule]
66
mod _bz2 {
7-
use super::super::{
8-
DecompressArgs, DecompressError, DecompressState, DecompressStatus, Decompressor,
9-
};
107
use crate::common::lock::PyMutex;
118
use crate::vm::{
129
VirtualMachine,
@@ -15,6 +12,9 @@ mod _bz2 {
1512
object::{PyPayload, PyResult},
1613
types::Constructor,
1714
};
15+
use crate::zlib::{
16+
DecompressArgs, DecompressError, DecompressState, DecompressStatus, Decompressor,
17+
};
1818
use bzip2::{Decompress, Status, write::BzEncoder};
1919
use rustpython_vm::convert::ToPyException;
2020
use std::{fmt, io::Write};
@@ -74,7 +74,7 @@ mod _bz2 {
7474
impl BZ2Decompressor {
7575
#[pymethod]
7676
fn decompress(&self, args: DecompressArgs, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
77-
let max_length = args.max_length_negative_is_none();
77+
let max_length = args.max_length();
7878
let data = &*args.data();
7979

8080
let mut state = self.state.lock();

stdlib/src/compression/generic.rs

Lines changed: 0 additions & 268 deletions
This file was deleted.

stdlib/src/compression/mod.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

stdlib/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ mod sha256;
2424
mod sha3;
2525
mod sha512;
2626

27-
mod compression;
2827
mod json;
2928
#[cfg(not(any(target_os = "ios", target_os = "android", target_arch = "wasm32")))]
3029
mod locale;
@@ -38,11 +37,13 @@ mod statistics;
3837
mod suggestions;
3938
// TODO: maybe make this an extension module, if we ever get those
4039
// mod re;
40+
mod bz2;
4141
#[cfg(not(target_arch = "wasm32"))]
4242
pub mod socket;
4343
#[cfg(all(unix, not(target_os = "redox")))]
4444
mod syslog;
4545
mod unicodedata;
46+
mod zlib;
4647

4748
mod faulthandler;
4849
#[cfg(any(unix, target_os = "wasi"))]
@@ -111,7 +112,7 @@ pub fn get_module_inits() -> impl Iterator<Item = (Cow<'static, str>, StdlibInit
111112
"array" => array::make_module,
112113
"binascii" => binascii::make_module,
113114
"_bisect" => bisect::make_module,
114-
"_bz2" => compression::bz2::make_module,
115+
"_bz2" => bz2::make_module,
115116
"cmath" => cmath::make_module,
116117
"_contextvars" => contextvars::make_module,
117118
"_csv" => csv::make_module,
@@ -132,7 +133,7 @@ pub fn get_module_inits() -> impl Iterator<Item = (Cow<'static, str>, StdlibInit
132133
"_statistics" => statistics::make_module,
133134
"_struct" => pystruct::make_module,
134135
"unicodedata" => unicodedata::make_module,
135-
"zlib" => compression::zlib::make_module,
136+
"zlib" => zlib::make_module,
136137
"_statistics" => statistics::make_module,
137138
"_suggestions" => suggestions::make_module,
138139
// crate::vm::sysmodule::sysconfigdata_name() => sysconfigdata::make_module,

0 commit comments

Comments
 (0)