socket.makefile(): overly restrictive 'mode' documented

Hi, The documentation for socket.makefile() says: socket.makefile(mode='r', […]) […] These arguments are interpreted the same way as by the built-in open() function, except the only supported mode values are 'r' (default), 'w' and 'b'. https://docs.python.org/3/library/socket.html#socket.socket.makefile The actual code, however, accepts mode values such as 'rw'; the value is required to be a string that's any combination of the listed characters: if not set(mode) <= {"r", "w", "b"}: raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,)) As it's quite useful to make a file object that's readable and writable, or writable and binary, the documentation should be changed to allow it. -- Michael
participants (1)
-
Michael Gold