# include "pycore_runtime.h" // _Py_ID()
#endif
#include "pycore_abstract.h" // _PyNumber_Index()
+#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
PyDoc_STRVAR(list_insert__doc__,
index = ival;
}
object = args[1];
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = list_insert_impl(self, index, object);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
static PyObject *
py_list_clear(PyListObject *self, PyObject *Py_UNUSED(ignored))
{
- return py_list_clear_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = py_list_clear_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(list_copy__doc__,
index = ival;
}
skip_optional:
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = list_pop_impl(self, index);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
static PyObject *
list_reverse(PyListObject *self, PyObject *Py_UNUSED(ignored))
{
- return list_reverse_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = list_reverse_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(list_index__doc__,
#define LIST_REMOVE_METHODDEF \
{"remove", (PyCFunction)list_remove, METH_O, list_remove__doc__},
+static PyObject *
+list_remove_impl(PyListObject *self, PyObject *value);
+
+static PyObject *
+list_remove(PyListObject *self, PyObject *value)
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = list_remove_impl(self, value);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
PyDoc_STRVAR(list___init____doc__,
"list(iterable=(), /)\n"
"--\n"
{
return list___reversed___impl(self);
}
-/*[clinic end generated code: output=f2d7b63119464ff4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3c9f24fd3212b18b input=a9049054013a1b77]*/
}
/*[clinic input]
+@critical_section
list.insert
index: Py_ssize_t
static PyObject *
list_insert_impl(PyListObject *self, Py_ssize_t index, PyObject *object)
-/*[clinic end generated code: output=7f35e32f60c8cb78 input=858514cf894c7eab]*/
+/*[clinic end generated code: output=7f35e32f60c8cb78 input=b1987ca998a4ae2d]*/
{
if (ins1(self, index, object) == 0)
Py_RETURN_NONE;
}
/*[clinic input]
+@critical_section
list.clear as py_list_clear
Remove all items from list.
static PyObject *
py_list_clear_impl(PyListObject *self)
-/*[clinic end generated code: output=83726743807e3518 input=378711e10f545c53]*/
+/*[clinic end generated code: output=83726743807e3518 input=e285b7f09051a9ba]*/
{
list_clear(self);
Py_RETURN_NONE;
}
/*[clinic input]
+@critical_section
list.pop
index: Py_ssize_t = -1
static PyObject *
list_pop_impl(PyListObject *self, Py_ssize_t index)
-/*[clinic end generated code: output=6bd69dcb3f17eca8 input=b83675976f329e6f]*/
+/*[clinic end generated code: output=6bd69dcb3f17eca8 input=c269141068ae4b8f]*/
{
PyObject *v;
int status;
}
/*[clinic input]
+@critical_section
list.reverse
Reverse *IN PLACE*.
static PyObject *
list_reverse_impl(PyListObject *self)
-/*[clinic end generated code: output=482544fc451abea9 input=eefd4c3ae1bc9887]*/
+/*[clinic end generated code: output=482544fc451abea9 input=04ac8e0c6a66e4d9]*/
{
if (Py_SIZE(self) > 1)
reverse_slice(self->ob_item, self->ob_item + Py_SIZE(self));
}
/*[clinic input]
+@critical_section
list.remove
value: object
[clinic start generated code]*/
static PyObject *
-list_remove(PyListObject *self, PyObject *value)
-/*[clinic end generated code: output=f087e1951a5e30d1 input=2dc2ba5bb2fb1f82]*/
+list_remove_impl(PyListObject *self, PyObject *value)
+/*[clinic end generated code: output=b9b76a6633b18778 input=26c813dbb95aa93b]*/
{
Py_ssize_t i;