FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update zlib from 3.12.6 and _ZlibDecompressor implementation by arihant2math · Pull Request #5476 · RustPython/RustPython · GitHub

Update zlib from 3.12.6 and _ZlibDecompressor implementation - #5476

Merged
youknowone merged 16 commits into
RustPython:mainfrom
arihant2math:zlib-312
Jan 16, 2025
Merged

Update zlib from 3.12.6 and _ZlibDecompressor implementation#5476
youknowone merged 16 commits into
RustPython:mainfrom
arihant2math:zlib-312

Conversation

arihant2math commented Jan 14, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

After this is merged a few GZip tests are unblocked.

Copy link
Copy Markdown
Member

To fix the failing test, you can run cargo fmt in the repository.

Copy link
Copy Markdown
Contributor Author

I can't seem to see how

zlibd = zlib._ZlibDecompressor()
self.assertRaises(TypeError, zlibd.decompress)

can produce a TypeError when using #[pymethod] on the rust side, unless it already does and I'm reading something incorrectly.

youknowone commented Jan 14, 2025
edited
Loading

Copy link
Copy Markdown
Member

Not only Constructor, it may also requires Initializer. Constructor corresponds to __new__ while Initializer corresponds to __init__

Sorry, I just checked CPython code but it doesn't look like that

Comment thread stdlib/src/zlib.rs Outdated

Copy link
Copy Markdown
Contributor Author

I resolved a few issues, but currently I'm getting a bunch of
RuntimeError: Expected payload '_ZlibDecompressor' but '_ZlibDecompressor' found

Copy link
Copy Markdown
Contributor Author

Additionally _ZlibDecompressor has to be unpicklable for another test to pass, but I'm fine with just disabling that one.

arihant2math marked this pull request as ready for review January 15, 2025 19:03

Copy link
Copy Markdown
Contributor Author

Also it seems to my knowledge __getstate__ isn't a magic method I can use? It would be nice to use it because then I could pass the pickling test rather trivially.

youknowone commented Jan 16, 2025
edited
Loading

Copy link
Copy Markdown
Member

Each class need to implement __getstate__ to support pickling. pickle library will use getstate in priority. Searching for fn getstate will result other types' implementation

Oh... unlike setstate, getstate doesn't have many implementations

youknowone left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

would you leave a comment which version of CPython did you brought python source from? (including x in 3.12.x)

youknowone changed the title _ZlibDecompressor implementation Update zlib from 3.12.6 and _ZlibDecompressor implementation Jan 16, 2025

youknowone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you so much!


has_fork_support = hasattr(os, "fork") and not is_emscripten and not is_wasi

# From python 3.12.6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I am sorry to confuse you. Version was required for commit message, but this is also fine too

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL