summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Include/cpython/listobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Include/cpython/listobject.h')
-rw-r--r--contrib/tools/python3/Include/cpython/listobject.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/tools/python3/Include/cpython/listobject.h b/contrib/tools/python3/Include/cpython/listobject.h
index 8fa82122d8d..49f5e8d6d1a 100644
--- a/contrib/tools/python3/Include/cpython/listobject.h
+++ b/contrib/tools/python3/Include/cpython/listobject.h
@@ -21,9 +21,6 @@ typedef struct {
Py_ssize_t allocated;
} PyListObject;
-PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
-PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
-
/* Cast argument to PyListObject* type. */
#define _PyList_CAST(op) \
(assert(PyList_Check(op)), _Py_CAST(PyListObject*, (op)))
@@ -32,7 +29,11 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
PyListObject *list = _PyList_CAST(op);
+#ifdef Py_GIL_DISABLED
+ return _Py_atomic_load_ssize_relaxed(&(_PyVarObject_CAST(list)->ob_size));
+#else
return Py_SIZE(list);
+#endif
}
#define PyList_GET_SIZE(op) PyList_GET_SIZE(_PyObject_CAST(op))
@@ -41,7 +42,12 @@ static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
static inline void
PyList_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
PyListObject *list = _PyList_CAST(op);
+ assert(0 <= index);
+ assert(index < list->allocated);
list->ob_item[index] = value;
}
#define PyList_SET_ITEM(op, index, value) \
PyList_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))
+
+PyAPI_FUNC(int) PyList_Extend(PyObject *self, PyObject *iterable);
+PyAPI_FUNC(int) PyList_Clear(PyObject *self);