-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Process.communicate() return type #13384
base: main
Are you sure you want to change the base?
Conversation
Diff from mypy_primer, showing the effect of this PR on open source code: aiohttp-devtools (https://github.com/aio-libs/aiohttp-devtools)
+ tests/test_runserver_cleanup.py:40: error: Unsupported right operand type for in ("bytes | None") [operator]
+ tests/test_runserver_cleanup.py:41: error: Item "None" of "bytes | None" has no attribute "decode" [union-attr]
core (https://github.com/home-assistant/core)
+ homeassistant/util/package.py:186: error: Item "None" of "bytes | None" has no attribute "decode" [union-attr]
+ homeassistant/components/command_line/utils.py:60: error: Item "None" of "bytes | None" has no attribute "strip" [union-attr]
+ homeassistant/auth/providers/command_line.py:95: error: Item "None" of "bytes | None" has no attribute "splitlines" [union-attr]
|
I can add |
I started an attempt to make it generic in #13385, but I think it'll be fairly complex to get working. |
Apparently, I can't even fix the runtime error with a cast...
|
if you need a workaround, I'd bet |
Yeah, I got it working with Does this PR seem like the right approach, or shall I spend more time getting the Generic PR working? |
With mypyc I get:
From the docs:
This could be more precise if the Process was Generic and the type depended on the arguments passed..