This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll'
Type: behavior Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Daniel Moore, davin, paul.moore, serhiy.storchaka, steve.dower, tim.golden, xiang.zhang, zach.ware
Priority: normal Keywords:

Created on 2017-05-07 19:01 by Daniel Moore, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1601 merged xiang.zhang, 2017-05-16 08:06
PR 1627 merged xiang.zhang, 2017-05-17 13:11
PR 1628 merged xiang.zhang, 2017-05-17 13:12
Messages (7)
msg293209 - (view) Author: Daniel Moore (Daniel Moore) Date: 2017-05-07 19:01
I originally posted this as a question on StackOverflow thinking I was doing something wrong:

http://stackoverflow.com/questions/43834494/python-3-6-attributeerror-simplequeue-object-has-no-attribute-poll/43835368#43835368

But I think I found the solution and answered my own question. I'm pretty sure you need to set:

self._poll = self._reader.poll

in the __setstate__ method in the SimpleQueue class of queues.py from the multiprocessing library. Otherwise, I'd love to know an alternative solution.

Thanks!
msg293753 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-16 07:51
Related commit is bdb1cf1ca56db25b33fb15dd91eef2cc32cd8973. A simple reproduce snippet:

import multiprocessing as mp

def foo(q):
    q.put('hello')
    assert not q.empty()

if __name__ == '__main__':
    mp.set_start_method('spawn')
    q = mp.SimpleQueue()
    p = mp.Process(target=foo, args=(q,))
    p.start()
    print(q.get())
    p.join()
msg293774 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-16 16:44
LGTM. But can you convert the reproducer to a test?
msg293838 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 04:20
Thanks for your reply Serhiy. Test added. :-)
msg293850 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 13:04
New changeset 6f75bc003ab4d5294b0291289ae03f7a8d305f46 by Xiang Zhang in branch 'master':
bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601)
https://github.com/python/cpython/commit/6f75bc003ab4d5294b0291289ae03f7a8d305f46
msg293853 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 14:02
New changeset 9081b36f330964faa4dee3af03228d2ca7c71835 by Xiang Zhang in branch '3.5':
bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601) (#1627)
https://github.com/python/cpython/commit/9081b36f330964faa4dee3af03228d2ca7c71835
msg293854 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-17 14:03
New changeset 43d4c0329e2348540a3a16ac61b3032f04eefd34 by Xiang Zhang in branch '3.6':
bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601) (#1628)
https://github.com/python/cpython/commit/43d4c0329e2348540a3a16ac61b3032f04eefd34
History
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74487
2017-05-17 14:06:16xiang.zhangsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-05-17 14:03:40xiang.zhangsetmessages: + msg293854
2017-05-17 14:02:58xiang.zhangsetmessages: + msg293853
2017-05-17 13:12:02xiang.zhangsetpull_requests: + pull_request1719
2017-05-17 13:11:42xiang.zhangsetpull_requests: + pull_request1718
2017-05-17 13:04:02xiang.zhangsetmessages: + msg293850
2017-05-17 04:20:46xiang.zhangsetmessages: + msg293838
2017-05-16 16:44:43serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg293774
2017-05-16 08:06:05xiang.zhangsetpull_requests: + pull_request1692
2017-05-16 07:51:13xiang.zhangsetversions: + Python 3.5, Python 3.7
nosy: + xiang.zhang

messages: + msg293753

type: crash -> behavior
stage: patch review
2017-05-10 23:52:33vstinnersettitle: “AttributeError: 'SimpleQueue' object has no attribute '_poll'” -> multiprocessing: AttributeError: 'SimpleQueue' object has no attribute '_poll'
2017-05-09 10:02:10xiang.zhangsetnosy: + davin
2017-05-07 19:01:50Daniel Moorecreate