typeshed
typeshed copied to clipboard
ProcessPoolExecutor initializer 3.11 overloads return object?
The docs say:
initializer is an optional callable that is called at the start of each worker process;
No mention of it returning anything.
And type is Callable[..., None]
as expected:
https://github.com/python/typeshed/blob/5eb040b1e60f5ec7833ea718abb0c24e48e04b7c/stdlib/concurrent/futures/process.pyi#L157-L159
But then for >=3.11
there's this overload:
https://github.com/python/typeshed/blob/5eb040b1e60f5ec7833ea718abb0c24e48e04b7c/stdlib/concurrent/futures/process.pyi#L173-L179
Seems to have come in on 8b3b6bf7cdbb8e5f3e842a8bfb1b654e73f10332. @AlexWaygood am I missing something? 🤔
We should update the instance variable. Every Callable[..., None]
is a Callable[[], object]
. ProcessPoolExecutor just ignores whatever is returned, so it's valid to pass something into it that happens to return a value. Typeshed typically prefers false negatives over false positives.
See also the discussion in https://github.com/PyCQA/flake8-pyi/issues/237#issue-1284861600
Oh, TIL isinstance(None, object)
, I guess that should have been obvious 🤪
We should update the instance variable.
I'm not sure what variable you mean? 🤔