New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiprocessing.JoinableQueue requires new kwarg #65566
Comments
Not mentioned (at least not specifically) in the release notes, multiprocessing.JoinableQueue now requires 'ctx' keyword argument: This causes an application calling JoinableQueue() to work with 3.3.2 (my single test) to work, but not with 3.4.0 TypeError: __init__() missing 1 required keyword-only argument: 'ctx' The documentation is also incorrect: https://docs.python.org/3.4/library/multiprocessing.html#multiprocessing.JoinableQueue |
Same issue (ctx keyword) occurs with multiprocessing.queues.SimpleQueue |
How are you importing JoinableQueue? You'll see this error if you import it from multiprocessing.queues instead of directly from multiprocessing. This is because multiprocessing.JoinableQueue is now a function: def JoinableQueue(self, maxsize=0):
'''Returns a queue object'''
from .queues import JoinableQueue
return JoinableQueue(maxsize, ctx=self.get_context()) It provides the required context argument for you. Make sure your application is doing "from multiprocessing import JoinableQueue", rather than "from multiprocessing.queues import JoinableQueue". |
We just got bitten by this issue because we are trying to be compatible across 2.x and 3.x (including 3.0-3.2). For anyone who runs into the "missing 1 required keyword-only argument: 'ctx'" here is an import statement that works: try: Replace SimpleQueue with JoinableQueue if you need that. Importing in the other order will wind you up in problems in 3.4.2+. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: