mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Issue #22581: Use more "bytes-like object" throughout the docs and comments.
This commit is contained in:
parent
6b335196c5
commit
b757c83ec6
12 changed files with 39 additions and 37 deletions
|
@ -849,7 +849,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
/* XXX WAAAAH! 's', 'y', 'z', 'u', 'Z', 'e', 'w' codes all
|
||||
need to be cleaned up! */
|
||||
|
||||
case 'y': {/* any buffer-like object, but not PyUnicode */
|
||||
case 'y': {/* any bytes-like object */
|
||||
void **p = (void **)va_arg(*p_va, char **);
|
||||
char *buf;
|
||||
Py_ssize_t count;
|
||||
|
@ -880,8 +880,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
break;
|
||||
}
|
||||
|
||||
case 's': /* text string */
|
||||
case 'z': /* text string or None */
|
||||
case 's': /* text string or bytes-like object */
|
||||
case 'z': /* text string, bytes-like object or None */
|
||||
{
|
||||
if (*format == '*') {
|
||||
/* "s*" or "z*" */
|
||||
|
@ -897,7 +897,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
arg, msgbuf, bufsize);
|
||||
PyBuffer_FillInfo(p, arg, sarg, len, 1, 0);
|
||||
}
|
||||
else { /* any buffer-like object */
|
||||
else { /* any bytes-like object */
|
||||
char *buf;
|
||||
if (getbuffer(arg, p, &buf) < 0)
|
||||
return converterr(buf, arg, msgbuf, bufsize);
|
||||
|
@ -908,7 +908,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
arg, msgbuf, bufsize);
|
||||
}
|
||||
format++;
|
||||
} else if (*format == '#') { /* any buffer-like object */
|
||||
} else if (*format == '#') { /* a string or read-only bytes-like object */
|
||||
/* "s#" or "z#" */
|
||||
void **p = (void **)va_arg(*p_va, char **);
|
||||
FETCH_SIZE;
|
||||
|
@ -926,7 +926,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*p = sarg;
|
||||
STORE_SIZE(len);
|
||||
}
|
||||
else { /* any buffer-like object */
|
||||
else { /* read-only bytes-like object */
|
||||
/* XXX Really? */
|
||||
char *buf;
|
||||
Py_ssize_t count = convertbuffer(arg, p, &buf);
|
||||
|
@ -967,7 +967,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
{
|
||||
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
|
||||
|
||||
if (*format == '#') { /* any buffer-like object */
|
||||
if (*format == '#') {
|
||||
/* "s#" or "Z#" */
|
||||
FETCH_SIZE;
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ w_complex_object(PyObject *v, char flag, WFILE *p)
|
|||
w_object(co->co_lnotab, p);
|
||||
}
|
||||
else if (PyObject_CheckBuffer(v)) {
|
||||
/* Write unknown buffer-style objects as a string */
|
||||
/* Write unknown bytes-like objects as a byte string */
|
||||
Py_buffer view;
|
||||
if (PyObject_GetBuffer(v, &view, PyBUF_SIMPLE) != 0) {
|
||||
w_byte(TYPE_UNKNOWN, p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue