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

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 22:03:35 +08:00 committed by GitHub
parent b769c91c2d
commit 43d4c0329e
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: