-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Incorrect conversion of numeric return values #8
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
Comments
See the HEAD of my branch where all number magic has been removed (and pickle support added). |
I've also noticed a failure in redis.py as a result of this automatic conversion: r = redis.Redis() will result in an AttributeError as the keys method assumes the data comes in as a string and attempts to split it by white space-- Traceback (most recent call last): |
I've pushed a new branch of redis-py called "newapi". It's a completely refactored client. There are numerous changes under the hood, including pipelining, a more consistent interface across commands, and removal of "magic value decoding". I've made an effort to be backwards compatible where possible, issuing DeprecationWarnings for things that will go away in a future version. Hopefully this will give people time to upgrade their code. Nevertheless, there are several backwards incompatible changes, most notably that the Redis client no longer attempts to be "clever" about casting values to ints and floats if the data looks like a number. For example:
There are tests for all the commands and I should have a working set of tests for pipelining and connection pooling this evening. If you have some spare cycles, it'd be awesome if you could give the new client a test drive and provide any feedback. Thanks! |
Great! -- J |
This issue has been resolved in the 1.34 release of redis-py. |
Remove mentions and workarounds for older Redis versions
Revert redis#8 and replace "redis" and "old valkey" with "server"
Currently all values will be converted using int or float_fn in _get_value if it's possible.
This is done regardless of what was actually put in.
This can lead to some hard to spot errors.
Example
As you can see the returned values no longer match in type. It's not very intuitive that some values automatically gets converted while other doesn't.
I think it would be more appropriate to always return the non converted values, unless, if made possible, some other type where explicitly provided.
The text was updated successfully, but these errors were encountered: