Skip to content

Add link about Python 2 GZip workaround #133

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

Merged
merged 1 commit into from
Nov 27, 2018
Merged

Add link about Python 2 GZip workaround #133

merged 1 commit into from
Nov 27, 2018

Conversation

jakirkham
Copy link
Member

Lest we or others wonder what this workaround is doing. Link back to the PR comment for details.

TL;DR - GZip on Python 2 (and Python pre-3.5) determines the number of bytes included via len, which is needed for the GZip footer. This will be incorrect if the data is not flattened and using a single byte type. Hence we cast to uint8 here to satisfy this constraint. On Python 3.5+ this is not needed as it casts the data to a memoryview and accesses the nbytes attribute to determine this.

ref: #128 (comment)

[Description of PR]

TODO:

  • Unit tests and/or doctests in docstrings
  • tox -e py37 passes locally
  • tox -e py27 passes locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • tox -e docs passes locally
  • AppVeyor and Travis CI passes
  • Test coverage to 100% (Coveralls passes)

Lest we or others wonder what this workaround is doing. Link back to the
PR comment for details.

TL;DR - GZip on Python 2 (and Python pre-3.5) determines the number of
bytes included via `len`, which is needed for the GZip footer. This will
be incorrect if the data is not flattened and using a single byte type.
Hence we cast to `uint8` here to satisfy this constraint. On Python 3.5+
this is not needed as it casts the data to a `memoryview` and accesses
the `nbytes` attribute to determine this.

ref: #128 (comment)
@jakirkham jakirkham mentioned this pull request Nov 27, 2018
8 tasks
@jakirkham jakirkham requested a review from alimanfoo November 27, 2018 23:21
@alimanfoo alimanfoo merged commit be0c1c2 into zarr-developers:master Nov 27, 2018
@alimanfoo
Copy link
Member

Good move, thanks.

@jakirkham jakirkham deleted the link_gzip_py2_workaround branch November 27, 2018 23:42
@alimanfoo alimanfoo added this to the 0.6.0 milestone Nov 27, 2018
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.

2 participants