bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601)

Under  *spawn* and *forkserver* start methods, SimpleQueue.empty() could
raise AttributeError due to not setting _poll in __setstate__.
This commit is contained in:
Xiang Zhang 2017-05-17 21:04:00 +08:00 committed by GitHub
parent 0774e79b93
commit 6f75bc003a
3 changed files with 40 additions and 0 deletions

View file

@ -337,6 +337,7 @@ class SimpleQueue(object):
def __setstate__(self, state):
(self._reader, self._writer, self._rlock, self._wlock) = state
self._poll = self._reader.poll
def get(self):
with self._rlock: