Skip to content

Commit a023bc2

Browse files
authored
gh-112087: Update list.{pop,clear,reverse,remove} to use CS (gh-113764)
1 parent 10d3f04 commit a023bc2

File tree

2 files changed

+46
-9
lines changed

2 files changed

+46
-9
lines changed

Objects/clinic/listobject.c.h

Lines changed: 35 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/listobject.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ list_ass_item(PyObject *aa, Py_ssize_t i, PyObject *v)
798798
}
799799

800800
/*[clinic input]
801+
@critical_section
801802
list.insert
802803
803804
index: Py_ssize_t
@@ -809,22 +810,23 @@ Insert object before index.
809810

810811
static PyObject *
811812
list_insert_impl(PyListObject *self, Py_ssize_t index, PyObject *object)
812-
/*[clinic end generated code: output=7f35e32f60c8cb78 input=858514cf894c7eab]*/
813+
/*[clinic end generated code: output=7f35e32f60c8cb78 input=b1987ca998a4ae2d]*/
813814
{
814815
if (ins1(self, index, object) == 0)
815816
Py_RETURN_NONE;
816817
return NULL;
817818
}
818819

819820
/*[clinic input]
821+
@critical_section
820822
list.clear as py_list_clear
821823
822824
Remove all items from list.
823825
[clinic start generated code]*/
824826

825827
static PyObject *
826828
py_list_clear_impl(PyListObject *self)
827-
/*[clinic end generated code: output=83726743807e3518 input=378711e10f545c53]*/
829+
/*[clinic end generated code: output=83726743807e3518 input=e285b7f09051a9ba]*/
828830
{
829831
list_clear(self);
830832
Py_RETURN_NONE;
@@ -1062,6 +1064,7 @@ list_inplace_concat(PyObject *_self, PyObject *other)
10621064
}
10631065

10641066
/*[clinic input]
1067+
@critical_section
10651068
list.pop
10661069
10671070
index: Py_ssize_t = -1
@@ -1074,7 +1077,7 @@ Raises IndexError if list is empty or index is out of range.
10741077

10751078
static PyObject *
10761079
list_pop_impl(PyListObject *self, Py_ssize_t index)
1077-
/*[clinic end generated code: output=6bd69dcb3f17eca8 input=b83675976f329e6f]*/
1080+
/*[clinic end generated code: output=6bd69dcb3f17eca8 input=c269141068ae4b8f]*/
10781081
{
10791082
PyObject *v;
10801083
int status;
@@ -2593,14 +2596,15 @@ PyList_Sort(PyObject *v)
25932596
}
25942597

25952598
/*[clinic input]
2599+
@critical_section
25962600
list.reverse
25972601
25982602
Reverse *IN PLACE*.
25992603
[clinic start generated code]*/
26002604

26012605
static PyObject *
26022606
list_reverse_impl(PyListObject *self)
2603-
/*[clinic end generated code: output=482544fc451abea9 input=eefd4c3ae1bc9887]*/
2607+
/*[clinic end generated code: output=482544fc451abea9 input=04ac8e0c6a66e4d9]*/
26042608
{
26052609
if (Py_SIZE(self) > 1)
26062610
reverse_slice(self->ob_item, self->ob_item + Py_SIZE(self));
@@ -2730,6 +2734,7 @@ list_count(PyListObject *self, PyObject *value)
27302734
}
27312735

27322736
/*[clinic input]
2737+
@critical_section
27332738
list.remove
27342739
27352740
value: object
@@ -2741,8 +2746,8 @@ Raises ValueError if the value is not present.
27412746
[clinic start generated code]*/
27422747

27432748
static PyObject *
2744-
list_remove(PyListObject *self, PyObject *value)
2745-
/*[clinic end generated code: output=f087e1951a5e30d1 input=2dc2ba5bb2fb1f82]*/
2749+
list_remove_impl(PyListObject *self, PyObject *value)
2750+
/*[clinic end generated code: output=b9b76a6633b18778 input=26c813dbb95aa93b]*/
27462751
{
27472752
Py_ssize_t i;
27482753

0 commit comments

Comments
 (0)