Skip to content

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jul 6, 2020

No description provided.

@JelleZijlstra
Copy link
Member

Looks like the multiprocessing changes from python/typeshed#4282 or python/typeshed#4289 are causing some issues.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 6, 2020

Yeah, multiprocessing.Queue is no longer a type in the stubs. At runtime it's not type, but it's documented as a class, which makes things confusing: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Queue

Also, multiprocessing.queues seems to be undocumented, so for a user to annotate code using queues, they need to either read the stubs or the stdlib implementation, which is unfortunate.

Finally, the return type of multiprocessing.Queue is Queue[Any], so the change loses some typing precision. Since multiprocessing.queues.Queue is not very discoverable (as it's undocumented), for many users this may effectively remove the ability to type check queue items.

The above considerations probably explain why multiprocessing.Queue used to be defined as a class, even thought it's not quite true.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 6, 2020

Perhaps more worryingly, the change breaks existing code that uses multiprocessing.Queue as a type. I'll create a typeshed issue about this.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 6, 2020

Let's move the discussion to python/typeshed#4313.

@JukkaL JukkaL closed this Jul 31, 2020
@JukkaL JukkaL deleted the typeshed branch July 31, 2020 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants