Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bz2 from CPython 3.10.5 #2444

Merged
merged 3 commits into from Aug 4, 2022
Merged

add bz2 from CPython 3.10.5 #2444

merged 3 commits into from Aug 4, 2022

Conversation

verhovsky
Copy link
Contributor

@verhovsky verhovsky commented Feb 9, 2021

pretty much copy and pasted from csv.rs.

@verhovsky

This comment has been minimized.

@verhovsky verhovsky force-pushed the add-bz2 branch 5 times, most recently from 7685368 to 0ea2868 Compare Feb 11, 2021
BZ2Compressor::make_class(ctx);

py_module!(vm, "_bz2", {
"BZ2Decompressor" => named_function!(ctx, _bz2, BZ2Decompressor),
Copy link
Member

@coolreader18 coolreader18 Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a WIP, but just a note - it looks like CPython exports _bz2.BZ2[De]compressor as the classes, rather as separate functions. You can move the functionality from _bz2_BZ2Decompressor to an associated function BZ2Decompressor::tp_new, with a #[pyslot] attribute on it, and same with BZ2Compressor. Then you can export directly as "BZ2Decompressor" => BZ2Decompressor::make_class(ctx)

verhovsky and others added 2 commits Aug 4, 2022
Co-Authored-By: Jeong YunWon <jeong@youknowone.org>
@youknowone youknowone marked this pull request as ready for review Aug 4, 2022
@fanninpm fanninpm requested a review from coolreader18 Aug 4, 2022
@@ -25,6 +25,8 @@ mod random;
mod statistics;
// TODO: maybe make this an extension module, if we ever get those
// mod re;
#[cfg(not(any(target_arch = "wasm32")))]
Copy link
Contributor

@fanninpm fanninpm Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[cfg(not(any(target_arch = "wasm32")))]
#[cfg(not(target_arch = "wasm32"))]

@youknowone youknowone changed the title add bz2 from CPython 3.8 add bz2 from CPython 3.10.5 Aug 4, 2022
Copy link
Member

@youknowone youknowone left a comment

not done but harmless to merge

@youknowone youknowone merged commit 8a307b8 into RustPython:main Aug 4, 2022
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants