##// END OF EJS Templates
cext: use modern buffer protocol in mpatch_flist()...
Gregory Szorc -
r40028:ec3c06a1 default
parent child Browse files
Show More
@@ -50,21 +50,22 b' static void setpyerr(int r)'
50 50
51 51 struct mpatch_flist *cpygetitem(void *bins, ssize_t pos)
52 52 {
53 const char *buffer;
54 struct mpatch_flist *res;
55 ssize_t blen;
53 Py_buffer buffer;
54 struct mpatch_flist *res = NULL;
56 55 int r;
57 56
58 57 PyObject *tmp = PyList_GetItem((PyObject *)bins, pos);
59 58 if (!tmp)
60 59 return NULL;
61 if (PyObject_AsCharBuffer(tmp, &buffer, (Py_ssize_t *)&blen))
60 if (PyObject_GetBuffer(tmp, &buffer, PyBUF_CONTIG_RO))
62 61 return NULL;
63 if ((r = mpatch_decode(buffer, blen, &res)) < 0) {
62 if ((r = mpatch_decode(buffer.buf, buffer.len, &res)) < 0) {
64 63 if (!PyErr_Occurred())
65 64 setpyerr(r);
66 return NULL;
65 res = NULL;
67 66 }
67
68 PyBuffer_Release(&buffer);
68 69 return res;
69 70 }
70 71
General Comments 0
You need to be logged in to leave comments. Login now