Coverage Report

Created: 2025-07-04 06:49

/src/cpython-install/include/python3.15/cpython/cellobject.h
Line
Count
Source (jump to first uncovered line)
1
/* Cell object interface */
2
3
#ifndef Py_LIMITED_API
4
#ifndef Py_CELLOBJECT_H
5
#define Py_CELLOBJECT_H
6
#ifdef __cplusplus
7
extern "C" {
8
#endif
9
10
typedef struct {
11
    PyObject_HEAD
12
    /* Content of the cell or NULL when empty */
13
    PyObject *ob_ref;
14
} PyCellObject;
15
16
PyAPI_DATA(PyTypeObject) PyCell_Type;
17
18
#define PyCell_Check(op) Py_IS_TYPE((op), &PyCell_Type)
19
20
PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
21
PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);
22
PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *);
23
24
0
static inline PyObject* PyCell_GET(PyObject *op) {
25
0
    PyObject *res;
26
0
    PyCellObject *cell;
27
0
    assert(PyCell_Check(op));
28
0
    cell = _Py_CAST(PyCellObject*, op);
29
0
    Py_BEGIN_CRITICAL_SECTION(cell);
30
0
    res = cell->ob_ref;
31
0
    Py_END_CRITICAL_SECTION();
32
0
    return res;
33
0
}
34
#define PyCell_GET(op) PyCell_GET(_PyObject_CAST(op))
35
36
0
static inline void PyCell_SET(PyObject *op, PyObject *value) {
37
0
    PyCellObject *cell;
38
0
    assert(PyCell_Check(op));
39
0
    cell = _Py_CAST(PyCellObject*, op);
40
0
    Py_BEGIN_CRITICAL_SECTION(cell);
41
0
    cell->ob_ref = value;
42
0
    Py_END_CRITICAL_SECTION();
43
0
}
44
#define PyCell_SET(op, value) PyCell_SET(_PyObject_CAST(op), (value))
45
46
#ifdef __cplusplus
47
}
48
#endif
49
#endif /* !Py_TUPLEOBJECT_H */
50
#endif /* Py_LIMITED_API */