mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-04 13:42:33 +02:00
Use a memoryview to avoid memcopies
This commit is contained in:
@@ -454,6 +454,7 @@ def parse_address_spec(spec: str) -> Tuple[AddressFamily, Union[Tuple[str, int],
|
||||
def write_all(fd: int, data: Union[str, bytes], block_until_written: bool = True) -> None:
|
||||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
data = memoryview(data)
|
||||
while data:
|
||||
try:
|
||||
n = os.write(fd, data)
|
||||
|
||||
Reference in New Issue
Block a user