summaryrefslogtreecommitdiff
path: root/asyncio/queues.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-05 15:27:34 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-07-05 15:27:34 +0200
commitc6b7d7c1bdaadd9297a4e47ddf5aa49388e38ad0 (patch)
tree3d01af7fd874b8aaec4799f45a9046e274df41b7 /asyncio/queues.py
parent07b14e3a7f103709232c304c0563b18d91a852ec (diff)
downloadtrollius-c6b7d7c1bdaadd9297a4e47ddf5aa49388e38ad0.tar.gz
Python issue 21447, 21886: Fix a race condition when setting the result of a
Future with call_soon(). Add an helper, an private method, to set the result only if the future was not cancelled.
Diffstat (limited to 'asyncio/queues.py')
-rw-r--r--asyncio/queues.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/asyncio/queues.py b/asyncio/queues.py
index 57afb05..41551a9 100644
--- a/asyncio/queues.py
+++ b/asyncio/queues.py
@@ -173,7 +173,7 @@ class Queue:
# run, we need to defer the put for a tick to ensure that
# getters and putters alternate perfectly. See
# ChannelTest.test_wait.
- self._loop.call_soon(putter.set_result, None)
+ self._loop.call_soon(putter._set_result_unless_cancelled, None)
return self._get()