[Python-checkins] cpython: Issue #22896: Fixed using _getbuffer() in recently added _PyBytes_Format().

serhiy.storchaka python-checkins at python.org
Tue Feb 3 01:05:58 CET 2015


https://hg.python.org/cpython/rev/0024537a4687
changeset:   94478:0024537a4687
parent:      94475:2e684ce772de
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Feb 03 01:49:18 2015 +0200
summary:
  Issue #22896: Fixed using _getbuffer() in recently added _PyBytes_Format().

files:
  Objects/bytesobject.c |  5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)


diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -622,14 +622,13 @@
             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 @@
                     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);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list