You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
multiprocessing Pool (and context manager) fixes/improvements (#1562)
* Use typing.ContextManager for multiprocessing context managers
Prior to this commit, the types for __enter__ and __exit__ were not
fully defined; this addresses that.
* Move Pool class stub to multiprocessing.pool
This is where the class is actually defined in the stdlib.
* Ensure that __enter__ on Pool subclasses returns the subclass
This ensures that:
```py
class MyPool(Pool):
def my_method(self): pass
with MyPool() as pool:
pool.my_method()
```
type-checks correctly.
* Update the signature of BaseContext.Pool to match Pool.__init__
* Restore multiprocessing.Pool as a function
And also add comments to note that it should have an identical signature
to multiprocessing.context.BaseContext.Pool (because it is just that
method partially applied).
0 commit comments