diff options
author | Guido van Rossum <guido@python.org> | 1997-08-12 14:55:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-08-12 14:55:56 (GMT) |
commit | de4a4ca2dd1a2bb2e65e32f7760b756a5f7788c4 (patch) | |
tree | d6d5f9fed6f0bc736562beea1a52d90da64faa12 /Modules/arraymodule.c | |
parent | ea46e4d93cd52501461125ff52c3d4104fed68d0 (diff) | |
download | cpython-de4a4ca2dd1a2bb2e65e32f7760b756a5f7788c4.zip cpython-de4a4ca2dd1a2bb2e65e32f7760b756a5f7788c4.tar.gz cpython-de4a4ca2dd1a2bb2e65e32f7760b756a5f7788c4.tar.bz2 |
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.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r-- | Modules/arraymodule.c | 10 |
1 files changed, 10 insertions, 0 deletions
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}, |