Skip to content

Commit

Permalink
termios: Fix type of tcgetattr and tcsetattr attributes (#4662)
Browse files Browse the repository at this point in the history
Returning a union from tcgetattr forces the caller to use isinstance or
a type: ignore comment if they modify the returned list. Return
List[Any] instead.

The cc field has ints at cc[termios.VTIME] and cc[termios.VMIN] if
lflag & termios.ICANON is zero. Change _Attr to allow this.

Fixes #4661
  • Loading branch information
cebtenzzre authored Oct 13, 2020
1 parent 86ca46f commit 58ee9c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stdlib/2and3/termios.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import FileDescriptorLike
from typing import List, Union
from typing import Any, List, Union

_Attr = List[Union[int, List[bytes]]]
_Attr = List[Union[int, List[Union[bytes, int]]]]

# TODO constants not really documented
B0: int
Expand Down Expand Up @@ -236,7 +236,7 @@ VWERASE: int
XCASE: int
XTABS: int

def tcgetattr(fd: FileDescriptorLike) -> _Attr: ...
def tcgetattr(fd: FileDescriptorLike) -> List[Any]: ...
def tcsetattr(fd: FileDescriptorLike, when: int, attributes: _Attr) -> None: ...
def tcsendbreak(fd: FileDescriptorLike, duration: int) -> None: ...
def tcdrain(fd: FileDescriptorLike) -> None: ...
Expand Down

0 comments on commit 58ee9c0

Please sign in to comment.