Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
SimpleQueue andQueue classes frommultiprocessing module in Python 3.11.0 do not support type[str] annotation.
Minimal, reproducible example:
frommultiprocessingimportQueuemultiprocessing_queue:Queue[str]=Queue()
or
frommultiprocessingimportSimpleQueuemultiprocessing_queue:SimpleQueue[str]=SimpleQueue()
Result - error:
multiprocessing_queue: SimpleQueue[str] = SimpleQueue() ~~~~~~~~~~~^^^^^TypeError: 'method' object is not subscriptable
How it should work:
It should work likeQueue from thequeue module:
fromqueueimportQueuestandard_queue:Queue[str]=Queue()
Result - no error.
Why do I need this?
I want my IDE to know thatqueue.get() returnsstr object.
Your environment
Python 3.11.0 arm64
Python 3.11.0 (main, Nov 4 2022, 17:22:54) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
MacBook M1 Pro macOS Ventura 13.0.1.