New submission from tzickel <icebr...@yahoo.com>:

os.writev and socket.sendmsg accept an iterable but the return value is number 
of bytes sent. That is not helpful as the user will have to write manual code 
to figure out which part of the iterable was not sent.

I propose to make a version of the functions where:

1. The return value is an iterable of the leftovers (including a maybe one-time 
memoryview into an item who has been partly-sent).

2. There is a small quirk where writev accepts only sequences but sendmsg 
accepts any iterable, which causes them not to behave the same for no good 
reason.

3. Do we want an sendmsgall like sendall in socket, where it doesn't give up 
until everything is sent ?

4. Today trying to use writev / sendmsg to be fully complaint requires checking 
the number of input items in the iterable to not go over IOV_MAX, maybe the 
python version of the functions should handle this automatically (and if it 
overflows, return the extra in leftovers) ?

Should the functions be the current one with an optional argument 
(return_leftovers) or a new function altogether.

----------
components: Library (Lib)
messages: 364651
nosy: larry, tzickel
priority: normal
severity: normal
status: open
title: os.writev and socket.sendmsg return value are not ideal
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40023>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to