[docs] [issue37073] clarify functions docs in IO modules and Bytes Objects
report at bugs.python.org
Tue May 28 03:18:04 EDT 2019
New submission from Windson Yang <wiwindson at outlook.com>:
> PyBytes_FromStringAndSize(const char *v, Py_ssize_t len):
> Return a new bytes object with a copy of the string v as value and length len on success, and NULL on failure. If v is NULL, the contents of the bytes object are uninitialized.
The function actually copies `len` bytes from string v instead of the whole string. (link 1) I suggested we can change to
> Return a new bytes object with a copy of the first len bytes of string v as value and length len on success...
> Read bytes into a pre-allocated, writable bytes-like object b and return the number of bytes read. For example, b might be a bytearray.
The function will call _bufferediobase_readinto_generic(link 2) which may return NULL. Maybe we can change to
> and return the number of bytes that read succeed (it may be smaller than b or NULL if failed)...
assignee: docs at python
nosy: Windson Yang, docs at python
title: clarify functions docs in IO modules and Bytes Objects
versions: Python 3.8
Python tracker <report at bugs.python.org>
More information about the docs