#ifndef Py_BUILD_CORE_BUILTIN
#define Py_BUILD_CORE_MODULE …
#endif
#include "Python.h"
#include "pycore_bytesobject.h"
#include "pycore_call.h"
#include "pycore_ceval.h"
#include "pycore_modsupport.h"
#include "pycore_moduleobject.h"
#include <stddef.h>
#include <stdbool.h>
struct arrayobject;
static struct PyModuleDef arraymodule;
struct arraydescr { … };
arrayobject;
arrayiterobject;
array_state;
static array_state *
get_array_state(PyObject *module)
{ … }
#define find_array_state_by_type(tp) …
#define get_array_state_by_class(cls) …
enum machine_format_code { … };
#define MACHINE_FORMAT_CODE_MIN …
#define MACHINE_FORMAT_CODE_MAX …
#include "clinic/arraymodule.c.h"
#define array_Check(op, state) …
static int
array_resize(arrayobject *self, Py_ssize_t newsize)
{ … }
static PyObject *
b_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
b_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
BB_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
BB_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
u_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
u_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
w_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
w_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
h_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
h_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
HH_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
HH_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
i_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
i_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
II_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
l_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
l_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
LL_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
LL_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
q_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
q_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
QQ_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
QQ_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
f_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
f_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
d_getitem(arrayobject *ap, Py_ssize_t i)
{ … }
static int
d_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ … }
#define DEFINE_COMPAREITEMS(code, type) …
DEFINE_COMPAREITEMS(b, signed char)
DEFINE_COMPAREITEMS(BB, unsigned char)
DEFINE_COMPAREITEMS(u, wchar_t)
DEFINE_COMPAREITEMS(w, Py_UCS4)
DEFINE_COMPAREITEMS(h, short)
DEFINE_COMPAREITEMS(HH, unsigned short)
DEFINE_COMPAREITEMS(i, int)
DEFINE_COMPAREITEMS(II, unsigned int)
DEFINE_COMPAREITEMS(l, long)
DEFINE_COMPAREITEMS(LL, unsigned long)
DEFINE_COMPAREITEMS(q, long long)
DEFINE_COMPAREITEMS(QQ, unsigned long long)
static const struct arraydescr descriptors[] = …;
static PyObject *
newarrayobject(PyTypeObject *type, Py_ssize_t size, const struct arraydescr *descr)
{ … }
static PyObject *
getarrayitem(PyObject *op, Py_ssize_t i)
{ … }
static int
ins1(arrayobject *self, Py_ssize_t where, PyObject *v)
{ … }
static int
array_tp_traverse(arrayobject *op, visitproc visit, void *arg)
{ … }
static void
array_dealloc(arrayobject *op)
{ … }
static PyObject *
array_richcompare(PyObject *v, PyObject *w, int op)
{ … }
static Py_ssize_t
array_length(arrayobject *a)
{ … }
static PyObject *
array_item(arrayobject *a, Py_ssize_t i)
{ … }
static PyObject *
array_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh)
{ … }
static PyObject *
array_array_clear_impl(arrayobject *self)
{ … }
static PyObject *
array_array___copy___impl(arrayobject *self)
{ … }
static PyObject *
array_array___deepcopy__(arrayobject *self, PyObject *unused)
{ … }
static PyObject *
array_concat(arrayobject *a, PyObject *bb)
{ … }
static PyObject *
array_repeat(arrayobject *a, Py_ssize_t n)
{ … }
static int
array_del_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh)
{ … }
static int
array_ass_item(arrayobject *a, Py_ssize_t i, PyObject *v)
{ … }
static int
setarrayitem(PyObject *a, Py_ssize_t i, PyObject *v)
{ … }
static int
array_iter_extend(arrayobject *self, PyObject *bb)
{ … }
static int
array_do_extend(array_state *state, arrayobject *self, PyObject *bb)
{ … }
static PyObject *
array_inplace_concat(arrayobject *self, PyObject *bb)
{ … }
static PyObject *
array_inplace_repeat(arrayobject *self, Py_ssize_t n)
{ … }
static PyObject *
ins(arrayobject *self, Py_ssize_t where, PyObject *v)
{ … }
static PyObject *
array_array_count(arrayobject *self, PyObject *v)
{ … }
static PyObject *
array_array_index_impl(arrayobject *self, PyObject *v, Py_ssize_t start,
Py_ssize_t stop)
{ … }
static int
array_contains(arrayobject *self, PyObject *v)
{ … }
static PyObject *
array_array_remove(arrayobject *self, PyObject *v)
{ … }
static PyObject *
array_array_pop_impl(arrayobject *self, Py_ssize_t i)
{ … }
static PyObject *
array_array_extend_impl(arrayobject *self, PyTypeObject *cls, PyObject *bb)
{ … }
static PyObject *
array_array_insert_impl(arrayobject *self, Py_ssize_t i, PyObject *v)
{ … }
static PyObject *
array_array_buffer_info_impl(arrayobject *self)
{ … }
static PyObject *
array_array_append(arrayobject *self, PyObject *v)
{ … }
static PyObject *
array_array_byteswap_impl(arrayobject *self)
{ … }
static PyObject *
array_array_reverse_impl(arrayobject *self)
{ … }
static PyObject *
array_array_fromfile_impl(arrayobject *self, PyTypeObject *cls, PyObject *f,
Py_ssize_t n)
{ … }
static PyObject *
array_array_tofile_impl(arrayobject *self, PyTypeObject *cls, PyObject *f)
{ … }
static PyObject *
array_array_fromlist(arrayobject *self, PyObject *list)
{ … }
static PyObject *
array_array_tolist_impl(arrayobject *self)
{ … }
static PyObject *
frombytes(arrayobject *self, Py_buffer *buffer)
{ … }
static PyObject *
array_array_frombytes_impl(arrayobject *self, Py_buffer *buffer)
{ … }
static PyObject *
array_array_tobytes_impl(arrayobject *self)
{ … }
static PyObject *
array_array_fromunicode_impl(arrayobject *self, PyObject *ustr)
{ … }
static PyObject *
array_array_tounicode_impl(arrayobject *self)
{ … }
static PyObject *
array_array___sizeof___impl(arrayobject *self)
{ … }
static const struct mformatdescr { … } mformat_descriptors[] = …;
static enum machine_format_code
typecode_to_mformat_code(char typecode)
{ … }
static PyObject *array_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject *
make_array(PyTypeObject *arraytype, char typecode, PyObject *items)
{ … }
static PyObject *
array__array_reconstructor_impl(PyObject *module, PyTypeObject *arraytype,
int typecode,
enum machine_format_code mformat_code,
PyObject *items)
{ … }
static PyObject *
array_array___reduce_ex___impl(arrayobject *self, PyTypeObject *cls,
PyObject *value)
{ … }
static PyObject *
array_get_typecode(arrayobject *a, void *closure)
{ … }
static PyObject *
array_get_itemsize(arrayobject *a, void *closure)
{ … }
static PyGetSetDef array_getsets [] = …;
static PyMethodDef array_methods[] = …;
static PyObject *
array_repr(arrayobject *a)
{ … }
static PyObject*
array_subscr(arrayobject* self, PyObject* item)
{ … }
static int
array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
{ … }
static const void *emptybuf = …;
static int
array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags)
{ … }
static void
array_buffer_relbuf(arrayobject *self, Py_buffer *view)
{ … }
static PyObject *
array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
PyDoc_STRVAR(module_doc,
"This module defines an object type which can efficiently represent\n\
an array of basic values: characters, integers, floating-point\n\
numbers. Arrays are sequence types and behave very much like lists,\n\
except that the type of objects stored in them is constrained.\n");
PyDoc_STRVAR(arraytype_doc,
"array(typecode [, initializer]) -> array\n\
\n\
Return a new array whose items are restricted by typecode, and\n\
initialized from the optional initializer value, which must be a list,\n\
string or iterable over elements of the appropriate type.\n\
\n\
Arrays represent basic values and behave very much like lists, except\n\
the type of objects stored in them is constrained. The type is specified\n\
at object creation time by using a type code, which is a single character.\n\
The following type codes are defined:\n\
\n\
Type code C Type Minimum size in bytes\n\
'b' signed integer 1\n\
'B' unsigned integer 1\n\
'u' Unicode character 2 (see note)\n\
'h' signed integer 2\n\
'H' unsigned integer 2\n\
'i' signed integer 2\n\
'I' unsigned integer 2\n\
'l' signed integer 4\n\
'L' unsigned integer 4\n\
'q' signed integer 8 (see note)\n\
'Q' unsigned integer 8 (see note)\n\
'f' floating-point 4\n\
'd' floating-point 8\n\
\n\
NOTE: The 'u' typecode corresponds to Python's unicode character. On\n\
narrow builds this is 2-bytes on wide builds this is 4-bytes.\n\
\n\
NOTE: The 'q' and 'Q' type codes are only available if the platform\n\
C compiler used to build Python supports 'long long', or, on Windows,\n\
'__int64'.\n\
\n\
Methods:\n\
\n\
append() -- append a new item to the end of the array\n\
buffer_info() -- return information giving the current memory info\n\
byteswap() -- byteswap all the items of the array\n\
count() -- return number of occurrences of an object\n\
extend() -- extend array by appending multiple elements from an iterable\n\
fromfile() -- read items from a file object\n\
fromlist() -- append items from the list\n\
frombytes() -- append items from the string\n\
index() -- return index of first occurrence of an object\n\
insert() -- insert a new item into the array at a provided position\n\
pop() -- remove and return item (default last)\n\
remove() -- remove first occurrence of an object\n\
reverse() -- reverse the order of the items in the array\n\
tofile() -- write all items to a file object\n\
tolist() -- return the array converted to an ordinary list\n\
tobytes() -- return the array converted to a string\n\
\n\
Attributes:\n\
\n\
typecode -- the typecode character used to create the array\n\
itemsize -- the length in bytes of one array item\n\
");
static PyObject *array_iter(arrayobject *ao);
static struct PyMemberDef array_members[] = …;
static PyType_Slot array_slots[] = …;
static PyType_Spec array_spec = …;
static PyObject *
array_iter(arrayobject *ao)
{ … }
static PyObject *
arrayiter_next(arrayiterobject *it)
{ … }
static void
arrayiter_dealloc(arrayiterobject *it)
{ … }
static int
arrayiter_traverse(arrayiterobject *it, visitproc visit, void *arg)
{ … }
static PyObject *
array_arrayiterator___reduce___impl(arrayiterobject *self, PyTypeObject *cls)
{ … }
static PyObject *
array_arrayiterator___setstate__(arrayiterobject *self, PyObject *state)
{ … }
static PyMethodDef arrayiter_methods[] = …;
static PyType_Slot arrayiter_slots[] = …;
static PyType_Spec arrayiter_spec = …;
static int
array_traverse(PyObject *module, visitproc visit, void *arg)
{ … }
static int
array_clear(PyObject *module)
{ … }
static void
array_free(void *module)
{ … }
static PyMethodDef a_methods[] = …;
#define CREATE_TYPE(module, type, spec) …
#define ADD_INTERNED(state, string) …
static int
array_modexec(PyObject *m)
{ … }
static PyModuleDef_Slot arrayslots[] = …;
static struct PyModuleDef arraymodule = …;
PyMODINIT_FUNC
PyInit_array(void)
{ … }