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

incrby rejects string amounts #141

Closed
eswald opened this issue Jan 31, 2017 · 2 comments
Closed

incrby rejects string amounts #141

eswald opened this issue Jan 31, 2017 · 2 comments

Comments

@eswald
Copy link

eswald commented Jan 31, 2017

redis.StrictRedis.incrby accepts strings for its amount parameter, because the network protocol ends up turning it into a string anyway. However, FakeStrictRedis does not, requiring that it be an actual int instance.

Granted, being stricter guarantees that Redis will work whenever FakeRedis does, but it's still a surprising difference.

@amw
Copy link
Contributor

amw commented Apr 18, 2017

I've been bitten by this as well. FakeRedis dies on a sane algorithm that is more readable in redis-py without explicit conversions:

# delay operation
r.incr('counter', 12)

# perform operation
value = r.get('counter')
do_something(value)
r.decr('counter', value)  # TypeError: unsupported operand type(s) for -: 'int' and 'str'

@bmerry
Copy link
Collaborator

bmerry commented Jan 14, 2019

Should be fixed in 1.0rc1.

@bmerry bmerry closed this as completed Jan 14, 2019
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

No branches or pull requests

3 participants