-
-
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
fcntl: various improvements #3680
Conversation
hauntsaninja
commented
Jan 28, 2020
- use overload for fcntl.ioctl
- use overload for fcntl.fcntl
- mark positional-only args
Little less sure about this one...
|
__request: int, | ||
__arg: bytearray, | ||
__mutate_flag: Literal[True] = ...) -> int: ... | ||
@overload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this overload can be omitted (note that bytearray
is treated as a subtype of bytes
to the typechecker).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the buffer protocol, see python/typing#593.
The comment about depending on the type of arg seems incorrect python@bf50135 I checked the docs and examples, CPython implementation and CPython tests, but I might be missing something
Based off of docs and examples
Follows the approach in python#2610
A recent change in Python's typeshed [1] leads to mypy complaining that there is no overload for ioctl() with the signature `int, int, bytes`. By adding an explicit `mutate_flag=False`, another overload is selected and mypy stays quiet. [1]: python/typeshed#3680 Signed-off-by: Harald Seiler <[email protected]>