Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 5982:6aebd970b7a9 legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 12 Aug 1997 14:55:56 +0000 |
| parents | 9b621ac09212 |
| children | 4f78504a5f81 |
line wrap: on
line diff
--- a/Modules/arraymodule.c Tue Aug 12 14:54:54 1997 +0000 +++ b/Modules/arraymodule.c Tue Aug 12 14:55:56 1997 +0000 @@ -712,6 +712,15 @@ } 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 @@ 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},
