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

Only fail on numpy import if using numpy #57

Merged
merged 3 commits into from
May 16, 2021
Merged

Conversation

milesgranger
Copy link
Owner

@milesgranger milesgranger commented May 16, 2021

Will fix #56

Seems the FromPyObject evaluates in the order of the enum variants. Placing numpy as the last variant in BytesType will alleviate the error mentioned in #56.

  • Add CI test for this.

@milesgranger milesgranger marked this pull request as ready for review May 16, 2021 08:11
@milesgranger milesgranger merged commit 4042d45 into master May 16, 2021
@milesgranger milesgranger deleted the fix-optional-numpy branch May 16, 2021 19:00
@messense
Copy link
Contributor

It works!

root@9acfadb9258b:/# pip install cramjam
Collecting cramjam
  Downloading cramjam-2.3.1-cp39-cp39-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (1.4 MB)
     |████████████████████████████████| 1.4 MB 1.3 MB/s
Installing collected packages: cramjam
Successfully installed cramjam-2.3.1
root@9acfadb9258b:/# python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cramjam
>>> compressed = cramjam.snappy.compress(b"bytes here")
>>> decompressed = cramjam.snappy.decompress(compressed)
>>> decompressed
cramjam.Buffer(len=10)
>>> bytes(decompressed)
b'bytes here'

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.

Handle numpy import error if numpy not installed.
2 participants