/home/mdboom/Work/builds/cpython/Include/internal/pycore_list.h
Line | Count | Source |
1 | #ifndef Py_INTERNAL_LIST_H |
2 | #define Py_INTERNAL_LIST_H |
3 | #ifdef __cplusplus |
4 | extern "C" { |
5 | #endif |
6 | |
7 | #ifndef Py_BUILD_CORE |
8 | # error "this header requires Py_BUILD_CORE define" |
9 | #endif |
10 | |
11 | #include "listobject.h" // _PyList_CAST() |
12 | |
13 | |
14 | /* runtime lifecycle */ |
15 | |
16 | extern void _PyList_Fini(PyInterpreterState *); |
17 | |
18 | |
19 | /* other API */ |
20 | |
21 | #ifndef WITH_FREELISTS |
22 | // without freelists |
23 | # define PyList_MAXFREELIST 0 |
24 | #endif |
25 | |
26 | /* Empty list reuse scheme to save calls to malloc and free */ |
27 | #ifndef PyList_MAXFREELIST |
28 | # define PyList_MAXFREELIST 80 |
29 | #endif |
30 | |
31 | struct _Py_list_state { |
32 | #if PyList_MAXFREELIST > 0 |
33 | PyListObject *free_list[PyList_MAXFREELIST]; |
34 | int numfree; |
35 | #endif |
36 | }; |
37 | |
38 | #define _PyList_ITEMS(op) (_PyList_CAST(op)->ob_item) |
39 | |
40 | extern int |
41 | _PyList_AppendTakeRefListResize(PyListObject *self, PyObject *newitem); |
42 | |
43 | static inline int |
44 | _PyList_AppendTakeRef(PyListObject *self, PyObject *newitem) |
45 | { |
46 | assert(self != NULL && newitem != NULL); |
47 | assert(PyList_Check(self)); |
48 | Py_ssize_t len = PyList_GET_SIZE(self); |
49 | Py_ssize_t allocated = self->allocated; |
50 | assert((size_t)len + 1 < PY_SSIZE_T_MAX); |
51 | if (allocated > len) { Branch (51:9): [True: 23.4M, False: 2.09M]
Branch (51:9): [True: 19.4M, False: 4.33M]
|
52 | PyList_SET_ITEM(self, len, newitem); |
53 | Py_SET_SIZE(self, len + 1); |
54 | return 0; |
55 | } |
56 | return _PyList_AppendTakeRefListResize(self, newitem); |
57 | } Unexecuted instantiation: myreadline.c:_PyList_AppendTakeRef Unexecuted instantiation: tokenizer.c:_PyList_AppendTakeRef Unexecuted instantiation: abstract.c:_PyList_AppendTakeRef Unexecuted instantiation: boolobject.c:_PyList_AppendTakeRef Unexecuted instantiation: bytearrayobject.c:_PyList_AppendTakeRef Unexecuted instantiation: bytesobject.c:_PyList_AppendTakeRef Unexecuted instantiation: call.c:_PyList_AppendTakeRef Unexecuted instantiation: cellobject.c:_PyList_AppendTakeRef Unexecuted instantiation: classobject.c:_PyList_AppendTakeRef Unexecuted instantiation: codeobject.c:_PyList_AppendTakeRef Unexecuted instantiation: complexobject.c:_PyList_AppendTakeRef Unexecuted instantiation: descrobject.c:_PyList_AppendTakeRef Unexecuted instantiation: enumobject.c:_PyList_AppendTakeRef Unexecuted instantiation: exceptions.c:_PyList_AppendTakeRef Unexecuted instantiation: genericaliasobject.c:_PyList_AppendTakeRef Unexecuted instantiation: genobject.c:_PyList_AppendTakeRef Unexecuted instantiation: fileobject.c:_PyList_AppendTakeRef Unexecuted instantiation: floatobject.c:_PyList_AppendTakeRef Unexecuted instantiation: frameobject.c:_PyList_AppendTakeRef Unexecuted instantiation: funcobject.c:_PyList_AppendTakeRef Unexecuted instantiation: interpreteridobject.c:_PyList_AppendTakeRef Unexecuted instantiation: iterobject.c:_PyList_AppendTakeRef listobject.c:_PyList_AppendTakeRef Line | Count | Source | 45 | { | 46 | assert(self != NULL && newitem != NULL); | 47 | assert(PyList_Check(self)); | 48 | Py_ssize_t len = PyList_GET_SIZE(self); | 49 | Py_ssize_t allocated = self->allocated; | 50 | assert((size_t)len + 1 < PY_SSIZE_T_MAX); | 51 | if (allocated > len) { Branch (51:9): [True: 23.4M, False: 2.09M]
| 52 | PyList_SET_ITEM(self, len, newitem); | 53 | Py_SET_SIZE(self, len + 1); | 54 | return 0; | 55 | } | 56 | return _PyList_AppendTakeRefListResize(self, newitem); | 57 | } |
Unexecuted instantiation: longobject.c:_PyList_AppendTakeRef Unexecuted instantiation: dictobject.c:_PyList_AppendTakeRef Unexecuted instantiation: odictobject.c:_PyList_AppendTakeRef Unexecuted instantiation: memoryobject.c:_PyList_AppendTakeRef Unexecuted instantiation: methodobject.c:_PyList_AppendTakeRef Unexecuted instantiation: moduleobject.c:_PyList_AppendTakeRef Unexecuted instantiation: object.c:_PyList_AppendTakeRef Unexecuted instantiation: rangeobject.c:_PyList_AppendTakeRef Unexecuted instantiation: setobject.c:_PyList_AppendTakeRef Unexecuted instantiation: sliceobject.c:_PyList_AppendTakeRef Unexecuted instantiation: structseq.c:_PyList_AppendTakeRef Unexecuted instantiation: tupleobject.c:_PyList_AppendTakeRef Unexecuted instantiation: typeobject.c:_PyList_AppendTakeRef Unexecuted instantiation: unicodeobject.c:_PyList_AppendTakeRef Unexecuted instantiation: unionobject.c:_PyList_AppendTakeRef Unexecuted instantiation: weakrefobject.c:_PyList_AppendTakeRef Unexecuted instantiation: _warnings.c:_PyList_AppendTakeRef Unexecuted instantiation: Python-ast.c:_PyList_AppendTakeRef Unexecuted instantiation: ast.c:_PyList_AppendTakeRef Unexecuted instantiation: ast_opt.c:_PyList_AppendTakeRef Unexecuted instantiation: ast_unparse.c:_PyList_AppendTakeRef Unexecuted instantiation: bltinmodule.c:_PyList_AppendTakeRef ceval.c:_PyList_AppendTakeRef Line | Count | Source | 45 | { | 46 | assert(self != NULL && newitem != NULL); | 47 | assert(PyList_Check(self)); | 48 | Py_ssize_t len = PyList_GET_SIZE(self); | 49 | Py_ssize_t allocated = self->allocated; | 50 | assert((size_t)len + 1 < PY_SSIZE_T_MAX); | 51 | if (allocated > len) { Branch (51:9): [True: 19.4M, False: 4.33M]
| 52 | PyList_SET_ITEM(self, len, newitem); | 53 | Py_SET_SIZE(self, len + 1); | 54 | return 0; | 55 | } | 56 | return _PyList_AppendTakeRefListResize(self, newitem); | 57 | } |
Unexecuted instantiation: codecs.c:_PyList_AppendTakeRef Unexecuted instantiation: compile.c:_PyList_AppendTakeRef Unexecuted instantiation: context.c:_PyList_AppendTakeRef Unexecuted instantiation: errors.c:_PyList_AppendTakeRef Unexecuted instantiation: frame.c:_PyList_AppendTakeRef Unexecuted instantiation: frozenmain.c:_PyList_AppendTakeRef Unexecuted instantiation: getargs.c:_PyList_AppendTakeRef Unexecuted instantiation: hamt.c:_PyList_AppendTakeRef Unexecuted instantiation: import.c:_PyList_AppendTakeRef Unexecuted instantiation: importdl.c:_PyList_AppendTakeRef Unexecuted instantiation: initconfig.c:_PyList_AppendTakeRef Unexecuted instantiation: marshal.c:_PyList_AppendTakeRef Unexecuted instantiation: mystrtoul.c:_PyList_AppendTakeRef Unexecuted instantiation: preconfig.c:_PyList_AppendTakeRef Unexecuted instantiation: pylifecycle.c:_PyList_AppendTakeRef Unexecuted instantiation: pystate.c:_PyList_AppendTakeRef Unexecuted instantiation: pythonrun.c:_PyList_AppendTakeRef Unexecuted instantiation: specialize.c:_PyList_AppendTakeRef Unexecuted instantiation: symtable.c:_PyList_AppendTakeRef Unexecuted instantiation: sysmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: thread.c:_PyList_AppendTakeRef Unexecuted instantiation: traceback.c:_PyList_AppendTakeRef Unexecuted instantiation: formatter_unicode.c:_PyList_AppendTakeRef Unexecuted instantiation: fileutils.c:_PyList_AppendTakeRef Unexecuted instantiation: dynload_shlib.c:_PyList_AppendTakeRef Unexecuted instantiation: main.c:_PyList_AppendTakeRef Unexecuted instantiation: gcmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: atexitmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: faulthandler.c:_PyList_AppendTakeRef Unexecuted instantiation: posixmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: signalmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: _tracemalloc.c:_PyList_AppendTakeRef Unexecuted instantiation: _collectionsmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: _iomodule.c:_PyList_AppendTakeRef Unexecuted instantiation: iobase.c:_PyList_AppendTakeRef Unexecuted instantiation: fileio.c:_PyList_AppendTakeRef Unexecuted instantiation: bytesio.c:_PyList_AppendTakeRef Unexecuted instantiation: bufferedio.c:_PyList_AppendTakeRef Unexecuted instantiation: textio.c:_PyList_AppendTakeRef Unexecuted instantiation: stringio.c:_PyList_AppendTakeRef Unexecuted instantiation: itertoolsmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: sre.c:_PyList_AppendTakeRef Unexecuted instantiation: _threadmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: timemodule.c:_PyList_AppendTakeRef Unexecuted instantiation: _weakref.c:_PyList_AppendTakeRef Unexecuted instantiation: _abc.c:_PyList_AppendTakeRef Unexecuted instantiation: _functoolsmodule.c:_PyList_AppendTakeRef Unexecuted instantiation: _operator.c:_PyList_AppendTakeRef Unexecuted instantiation: deepfreeze.c:_PyList_AppendTakeRef |
58 | |
59 | typedef struct { |
60 | PyObject_HEAD |
61 | Py_ssize_t it_index; |
62 | PyListObject *it_seq; /* Set to NULL when iterator is exhausted */ |
63 | } _PyListIterObject; |
64 | |
65 | #ifdef __cplusplus |
66 | } |
67 | #endif |
68 | #endif /* !Py_INTERNAL_LIST_H */ |