diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-09-26 21:49:22 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-09-26 21:49:22 (GMT) |
commit | 60320cb3e4fa0d77ae5f8634d83de497bba003f6 (patch) | |
tree | ab3e84cb632dae602140ad8392170c7392930699 /Objects | |
parent | 8a1b689e85a367c1a5f0bcbdcc7cd28e3f20d162 (diff) | |
download | cpython-60320cb3e4fa0d77ae5f8634d83de497bba003f6.zip cpython-60320cb3e4fa0d77ae5f8634d83de497bba003f6.tar.gz cpython-60320cb3e4fa0d77ae5f8634d83de497bba003f6.tar.bz2 |
#3946 fix PyObject_CheckBuffer on a memoryview object
reviewed by Antoine
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 39cb803..aee20d6 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -268,16 +268,16 @@ int PyObject_CheckReadBuffer(PyObject *obj) { PyBufferProcs *pb = obj->ob_type->tp_as_buffer; + Py_buffer view; if (pb == NULL || pb->bf_getbuffer == NULL) return 0; - if ((*pb->bf_getbuffer)(obj, NULL, PyBUF_SIMPLE) == -1) { + if ((*pb->bf_getbuffer)(obj, &view, PyBUF_SIMPLE) == -1) { PyErr_Clear(); return 0; } - if (*pb->bf_releasebuffer != NULL) - (*pb->bf_releasebuffer)(obj, NULL); + PyBuffer_Release(&view); return 1; } |