Title: Recent multiprocessing.Queue change breaks existing annotations and reduces typing precision · Issue #4313 · python/typeshed · GitHub
Open Graph Title: Recent multiprocessing.Queue change breaks existing annotations and reduces typing precision · Issue #4313 · python/typeshed
X Title: Recent multiprocessing.Queue change breaks existing annotations and reduces typing precision · Issue #4313 · python/typeshed
Description: #4289 changed multiprocessing.Queue from a class to a function. This matches the implementation, but this has some possibly unanticipated side effects, as discussed in python/mypy#9100. Here's a summary of the points raised in the linked...
Open Graph Description: #4289 changed multiprocessing.Queue from a class to a function. This matches the implementation, but this has some possibly unanticipated side effects, as discussed in python/mypy#9100. Here's a su...
X Description: #4289 changed multiprocessing.Queue from a class to a function. This matches the implementation, but this has some possibly unanticipated side effects, as discussed in python/mypy#9100. Here's ...
Opengraph URL: https://github.com/python/typeshed/issues/4313
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Recent multiprocessing.Queue change breaks existing annotations and reduces typing precision","articleBody":"#4289 changed `multiprocessing.Queue` from a class to a function. This matches the implementation, but this has some possibly unanticipated side effects, as discussed in https://github.com/python/mypy/pull/9100. Here's a summary of the points raised in the linked PR:\r\n\r\n* `multiprocessing.Queue` is documented as a class: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Queue\r\n\r\n* `multiprocessing.queues.Queue` can be used in annotations, but it seems to be undocumented. For a user to annotate code using queues, they need to either read the stubs or the stdlib implementation, which is unfortunate.\r\n\r\n* The return type of `multiprocessing.Queue` is `Queue[Any]`, so the change loses some typing precision, even if a user can figure out the correct type. Since `multiprocessing.queues.Queue` is not very discoverable (as it's undocumented), for many new users this may effectively remove the ability to type check queue items.\r\n\r\n* The change breaks existing code that uses `multiprocessing.Queue` as a type, without an obvious fix.\r\n\r\nThe above considerations probably explain why `multiprocessing.Queue` used to be defined as a class, even thought it's not quite true.\r\n\r\nI'm not sure what's the best way forward. Here are some ideas:\r\n\r\n* Revert the change to `Queue` and other similar types (at least for now).\r\n* Teach type checkers to suggest using `multiprocessing.queues.Queue` (etc.) in type annotations. However, if these are undocumented, maybe we shouldn't recommend these?\r\n* Change the return type of `multiprocessing.Queue` to `Queue[T]` to preserve type checking precision (this may not work on all type checkers).","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2020-07-06T17:25:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/4313/typeshed/issues/4313"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ffe67b93-de94-b7f9-1446-1034f1497ec3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 91C6:186E38:F263D:1474B2:6969557F |
| html-safe-nonce | 8bcdbfb572ed423f056cb5f7c19d48879474657a05cf0266f5efeae80b48f52c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUM2OjE4NkUzODpGMjYzRDoxNDc0QjI6Njk2OTU1N0YiLCJ2aXNpdG9yX2lkIjoiODc3MzU5MjMwMDE5ODEyMjg3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e048c00313c59f754046e7af3d36b86921d0257523a066d3a9ce95bd296638f0 |
| hovercard-subject-tag | issue:651704626 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/4313/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0b3de8a610430f0cf061a768563640ac504870c843ad71b32dff913e3401f397/python/typeshed/issues/4313 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0b3de8a610430f0cf061a768563640ac504870c843ad71b32dff913e3401f397/python/typeshed/issues/4313 |
| og:image:alt | #4289 changed multiprocessing.Queue from a class to a function. This matches the implementation, but this has some possibly unanticipated side effects, as discussed in python/mypy#9100. Here's a su... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9db5f28da7e24035385d7f349f17890cbe016a939ddd7952be0f07b862094f5a |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4e59fe66217d3c72925af2a341ae3a8f2b5b5b2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width