summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-03-13 18:18:51 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-03-13 18:18:51 (GMT)
commit3aa82c07f709a532de28a39308c23757d3b9c91b (patch)
tree9afcb4a3e014ee23daac39f38f45cb3b21811345 /Modules/arraymodule.c
parent42bec93e5c0fd114b2f4c3c498b35001d97a94c4 (diff)
downloadcpython-3aa82c07f709a532de28a39308c23757d3b9c91b.zip
cpython-3aa82c07f709a532de28a39308c23757d3b9c91b.tar.gz
cpython-3aa82c07f709a532de28a39308c23757d3b9c91b.tar.bz2
SF bug #910986: copy.copy fails for array.array
Added support for the copy module.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 9382927..bda5fef 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -617,6 +617,17 @@ array_slice(arrayobject *a, int ilow, int ihigh)
}
static PyObject *
+array_copy(arrayobject *a, PyObject *unused)
+{
+ return array_slice(a, 0, a->ob_size);
+}
+
+PyDoc_STRVAR(copy_doc,
+"copy(array)\n\
+\n\
+ Return a copy of the array.");
+
+static PyObject *
array_concat(arrayobject *a, PyObject *bb)
{
int size;
@@ -1409,8 +1420,12 @@ PyMethodDef array_methods[] = {
buffer_info_doc},
{"byteswap", (PyCFunction)array_byteswap, METH_NOARGS,
byteswap_doc},
+ {"__copy__", (PyCFunction)array_copy, METH_NOARGS,
+ copy_doc},
{"count", (PyCFunction)array_count, METH_O,
count_doc},
+ {"__deepcopy__",(PyCFunction)array_copy, METH_NOARGS,
+ copy_doc},
{"extend", (PyCFunction)array_extend, METH_O,
extend_doc},
{"fromfile", (PyCFunction)array_fromfile, METH_VARARGS,