From de4a4ca2dd1a2bb2e65e32f7760b756a5f7788c4 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 12 Aug 1997 14:55:56 +0000 Subject: Added buffer_info() method that returns address and length in bytes of the buffer used to hold the array -- for dangerous low-level I/O. --- Modules/arraymodule.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index debd594..6920cbf 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -712,6 +712,15 @@ array_insert(self, args) } static PyObject * +array_buffer_info(self, args) + arrayobject *self; + PyObject *args; +{ + return Py_BuildValue("ll", + (long)(self->ob_item), (long)(self->ob_size)); +} + +static PyObject * array_append(self, args) arrayobject *self; PyObject *args; @@ -1050,6 +1059,7 @@ array_tostring(self, args) static PyMethodDef array_methods[] = { {"append", (PyCFunction)array_append}, + {"buffer_info", (PyCFunction)array_buffer_info}, {"byteswap", (PyCFunction)array_byteswap}, /* {"count", (method)array_count},*/ {"fromfile", (PyCFunction)array_fromfile}, -- cgit v0.12