Skip to content

Commit

Permalink
Merge pull request aio-libs-abandoned#658 from dmvass/bugfix/657
Browse files Browse the repository at this point in the history
Fix transaction data decoding
  • Loading branch information
popravich authored Nov 28, 2019
2 parents 80abe42 + 4d1d3e6 commit 52345bc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/657.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix transaction data decoding
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ Volodymyr Hotsyk
Youngmin Koo <youngminz>
Dima Kit
<curiouscod3>
Dmitry Vasilishin <dmvass>
1 change: 1 addition & 0 deletions aioredis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def execute(self, command, *args, encoding=_NOTSET):
cb = self._start_transaction
elif command in ('EXEC', b'EXEC'):
cb = partial(self._end_transaction, discard=False)
encoding = None
elif command in ('DISCARD', b'DISCARD'):
cb = partial(self._end_transaction, discard=True)
else:
Expand Down
5 changes: 4 additions & 1 deletion tests/transaction_commands_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,16 @@ async def test_global_encoding(redis, create_redis, server):
tr = redis.multi_exec()
fut1 = tr.get('key')
fut2 = tr.get('key', encoding='utf-8')
fut3 = tr.hgetall('hash-key', encoding='utf-8')
fut3 = tr.get('key', encoding=None)
fut4 = tr.hgetall('hash-key', encoding='utf-8')
await tr.execute()
res = await fut1
assert res == 'value'
res = await fut2
assert res == 'value'
res = await fut3
assert res == b'value'
res = await fut4
assert res == {'foo': 'val1', 'bar': 'val2'}


Expand Down

0 comments on commit 52345bc

Please sign in to comment.