Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d3ec059b89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| except ImportError: | ||
| _zstandard_installed = False |
There was a problem hiding this comment.
Define zstandard in ImportError branch
When import zstandard fails on Python 3.13 and below, this branch only sets _zstandard_installed = False and leaves zstandard undefined. Later in the same module, the if zstandard is None: check runs unconditionally, so importing _decoders.py raises a NameError in environments that do not install the optional zstd extra. That turns an optional dependency into an import-time crash for all decoding paths, not just zstd.
Useful? React with 👍 / 👎.
| # Zstandard support is optional on Python <= 3.13. | ||
| # On Python 3.14, the stdlib includes a built-in zstd implementation, so we can support | ||
| # it without an extra dependency. | ||
| if typing.TYPE_CHECKING: | ||
| if sys.version_info >= (3, 14): | ||
| from compression.zstd import ZstdDecompressor, ZstdError | ||
| else: | ||
| from zstandard import ZstdDecompressor as _ZstdDecompressor, ZstdError | ||
|
|
||
| ZstdDecompressor = functools.partial(_ZstdDecompressor().decompressobj) | ||
|
|
||
| _zstandard_installed: bool = True | ||
| else: # pragma: no cover | ||
| if sys.version_info >= (3, 14): | ||
| from compression.zstd import ZstdDecompressor, ZstdError | ||
|
|
||
| _zstandard_installed = True | ||
| else: | ||
| try: | ||
| from zstandard import ZstdDecompressor as _ZstdDecompressor, ZstdError | ||
|
|
||
| ZstdDecompressor = functools.partial(_ZstdDecompressor().decompressobj) | ||
| _zstandard_installed = True | ||
| except ImportError: | ||
| _zstandard_installed = False |
There was a problem hiding this comment.
It's crazy that I need to do this.
Work done with bad internet, and without any coding agent. It's very rewarding to just code.