-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Got "TypeError: must be convertible to a buffer, not bytearray" in PyPy #708
Comments
I checked hiredis-py's usage, method |
This error was catched so can't be throwed out, only use single-step debug can find it. |
I'm not sure about this. The whole point of using a Casting the Does PyPy treat "Both bytes and bytearray objects support the common sequence operations. They interoperate not just with operands of the same type, but with any bytes-like object. Due to this flexibility, they can be freely mixed in operations without causing errors." |
Yeah, I'm sure that the behavior of bytearray is different on pypy 4.0.1. Maybe I provide a simple way to reproduce it? I think could just check if interpreter is pypy then use bytes method? |
Can simply reproduce by below program. import hiredis
test = bytearray()
reader = hiredis.Reader()
reader.feed(test) Python 2.7.10 run it no problem, but use PyPy 4.0.1 got below error.
|
It looks like this is a hiredis-py error. The Also, these two tests (https://github.com/redis/hiredis-py/blob/master/test/reader.py#L133-L139) cause the test runner to segfault against PyPy 4.0.1. Not sure why, but this is likely another problem you'll run into trying to run hiredis-py on PyPy. I commented them out temporarily to get the rest of the suite to run and see the I'm not very familiar with PyPy (certainly not at the C extension level), so I'm not sure where to really start. |
Well, I think the temporary solution to solve this problem is disable hiredis-py when using PyPy, I think pure Python code run on PyPy have an acceptable performance. |
I created an issue on the hiredis-py repo. Hopefully someone more familiar with PyPy than I can take a look. |
FWIW I just got the same error with PyPy 5.1.2 (Python 2.7.10, Ubuntu 16.04):
|
PyPy fixed their ByteArray support in version 5.3. hiredis-py (and redis-py with hiredis-py enabled) works with PyPy 5.3 or later. |
Now I just move hiredis out, redis clients works no problem.
The text was updated successfully, but these errors were encountered: