mirror of https://github.com/python/cpython
Issue #22896: Fixed using _getbuffer() in recently added _PyBytes_Format().
This commit is contained in:
parent
3dd3e26680
commit
83848704f5
|
@ -622,14 +622,13 @@ _PyBytes_Format(PyObject *format, PyObject *args)
|
||||||
int isnumok;
|
int isnumok;
|
||||||
PyObject *v = NULL;
|
PyObject *v = NULL;
|
||||||
PyObject *temp = NULL;
|
PyObject *temp = NULL;
|
||||||
Py_buffer buf;
|
Py_buffer buf = {NULL, NULL};
|
||||||
char *pbuf;
|
char *pbuf;
|
||||||
int sign;
|
int sign;
|
||||||
Py_ssize_t len;
|
Py_ssize_t len;
|
||||||
char formatbuf[FORMATBUFLEN];
|
char formatbuf[FORMATBUFLEN];
|
||||||
/* For format{int,char}() */
|
/* For format{int,char}() */
|
||||||
|
|
||||||
buf.obj = NULL;
|
|
||||||
fmt++;
|
fmt++;
|
||||||
if (*fmt == '(') {
|
if (*fmt == '(') {
|
||||||
char *keystart;
|
char *keystart;
|
||||||
|
@ -790,7 +789,7 @@ _PyBytes_Format(PyObject *format, PyObject *args)
|
||||||
Py_DECREF(temp);
|
Py_DECREF(temp);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (_getbuffer(repr, &buf) < 0) {
|
if (PyObject_GetBuffer(repr, &buf, PyBUF_SIMPLE) != 0) {
|
||||||
temp = format_obj(repr);
|
temp = format_obj(repr);
|
||||||
if (temp == NULL) {
|
if (temp == NULL) {
|
||||||
Py_DECREF(repr);
|
Py_DECREF(repr);
|
||||||
|
|
Loading…
Reference in New Issue