mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
SF bug #910986: copy.copy fails for array.array
Added support for the copy module.
This commit is contained in:
parent
42bec93e5c
commit
3aa82c07f7
3 changed files with 24 additions and 0 deletions
|
@ -616,6 +616,17 @@ array_slice(arrayobject *a, int ilow, int ihigh)
|
|||
return (PyObject *)np;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue