summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-02 23:49:18 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-02 23:49:18 (GMT)
commit83848704f550912fe559988d6de0b5105844d75f (patch)
treed65b091b56bdb1528a4eb34e046fd7ba196a6464 /Objects
parent3dd3e26680110b3eeadedc9c8457dfe1db2b913c (diff)
downloadcpython-83848704f550912fe559988d6de0b5105844d75f.zip
cpython-83848704f550912fe559988d6de0b5105844d75f.tar.gz
cpython-83848704f550912fe559988d6de0b5105844d75f.tar.bz2
Issue #22896: Fixed using _getbuffer() in recently added _PyBytes_Format().
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytesobject.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index b2fbc92..b2bf098 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -622,14 +622,13 @@ _PyBytes_Format(PyObject *format, PyObject *args)
int isnumok;
PyObject *v = NULL;
PyObject *temp = NULL;
- Py_buffer buf;
+ Py_buffer buf = {NULL, NULL};
char *pbuf;
int sign;
Py_ssize_t len;
char formatbuf[FORMATBUFLEN];
/* For format{int,char}() */
- buf.obj = NULL;
fmt++;
if (*fmt == '(') {
char *keystart;
@@ -790,7 +789,7 @@ _PyBytes_Format(PyObject *format, PyObject *args)
Py_DECREF(temp);
goto error;
}
- if (_getbuffer(repr, &buf) < 0) {
+ if (PyObject_GetBuffer(repr, &buf, PyBUF_SIMPLE) != 0) {
temp = format_obj(repr);
if (temp == NULL) {
Py_DECREF(repr);