@@ -5026,8 +5026,17 @@ Array_init(PyObject *self, PyObject *args, PyObject *kw)
50265026 return 0 ;
50275027}
50285028
5029+ /*[clinic input]
5030+ @critical_section
5031+ _ctypes.Array.__getitem__ as Array_item
5032+ myself: self
5033+ index: Py_ssize_t
5034+ /
5035+ [clinic start generated code]*/
5036+
50295037static PyObject *
5030- Array_item_lock_held (PyObject * myself , Py_ssize_t index )
5038+ Array_item_impl (PyObject * myself , Py_ssize_t index )
5039+ /*[clinic end generated code: output=d038162d727d7d9b input=68fa9889c77bb8c9]*/
50315040{
50325041 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (myself );
50335042
@@ -5056,18 +5065,17 @@ Array_item_lock_held(PyObject *myself, Py_ssize_t index)
50565065 index , size , self -> b_ptr + offset );
50575066}
50585067
5059- static PyObject *
5060- Array_item (PyObject * myself , Py_ssize_t index )
5061- {
5062- PyObject * result ;
5063- Py_BEGIN_CRITICAL_SECTION (myself );
5064- result = Array_item_lock_held (myself , index );
5065- Py_END_CRITICAL_SECTION ();
5066- return result ;
5067- }
5068+ /*[clinic input]
5069+ @critical_section
5070+ _ctypes.Array.__getitem__ as Array_subscript
5071+ myself: self
5072+ item: object
5073+ /
5074+ [clinic start generated code]*/
50685075
50695076static PyObject *
5070- Array_subscript_lock_held (PyObject * myself , PyObject * item )
5077+ Array_subscript_impl (PyObject * myself , PyObject * item )
5078+ /*[clinic end generated code: output=5c88d612ad5c8a1a input=510935495a857cac]*/
50715079{
50725080 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (myself );
50735081
@@ -5080,7 +5088,7 @@ Array_subscript_lock_held(PyObject *myself, PyObject *item)
50805088 return NULL ;
50815089 if (i < 0 )
50825090 i += self -> b_length ;
5083- return Array_item_lock_held (myself , i );
5091+ return Array_item_impl (myself , i );
50845092 }
50855093 else if (PySlice_Check (item )) {
50865094 PyObject * proto ;
@@ -5168,7 +5176,7 @@ Array_subscript_lock_held(PyObject *myself, PyObject *item)
51685176
51695177 for (cur = start , i = 0 ; i < slicelen ;
51705178 cur += step , i ++ ) {
5171- PyObject * v = Array_item_lock_held (myself , cur );
5179+ PyObject * v = Array_item_impl (myself , cur );
51725180 if (v == NULL ) {
51735181 Py_DECREF (np );
51745182 return NULL ;
@@ -5185,16 +5193,6 @@ Array_subscript_lock_held(PyObject *myself, PyObject *item)
51855193}
51865194
51875195
5188- static PyObject *
5189- Array_subscript (PyObject * myself , PyObject * item )
5190- {
5191- PyObject * result ;
5192- Py_BEGIN_CRITICAL_SECTION (myself );
5193- result = Array_subscript_lock_held (myself , item );
5194- Py_END_CRITICAL_SECTION ();
5195- return result ;
5196- }
5197-
51985196/*[clinic input]
51995197@critical_section
52005198_ctypes.Array.__setitem__ as Array_ass_item
@@ -5577,8 +5575,22 @@ static PyType_Spec pycsimple_spec = {
55775575/*
55785576 PyCPointer_Type
55795577*/
5578+ /*[clinic input]
5579+ class _ctypes._Pointer "PyObject *" "clinic_state()->PyCPointer_Type"
5580+ [clinic start generated code]*/
5581+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=452695db70aa7c3e]*/
5582+
5583+ /*[clinic input]
5584+ @critical_section
5585+ _ctypes._Pointer.__getitem__ as Pointer_item
5586+ myself: self
5587+ index: Py_ssize_t
5588+ /
5589+ [clinic start generated code]*/
5590+
55805591static PyObject *
5581- Pointer_item_lock_held (PyObject * myself , Py_ssize_t index )
5592+ Pointer_item_impl (PyObject * myself , Py_ssize_t index )
5593+ /*[clinic end generated code: output=4ae9d566e8038853 input=17943427cd04ed08]*/
55825594{
55835595 CDataObject * self = _CDataObject_CAST (myself );
55845596 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (self );
@@ -5617,21 +5629,6 @@ Pointer_item_lock_held(PyObject *myself, Py_ssize_t index)
56175629 index , size , (char * )((char * )deref + offset ));
56185630}
56195631
5620- static PyObject *
5621- Pointer_item (PyObject * self , Py_ssize_t index )
5622- {
5623- PyObject * res ;
5624- Py_BEGIN_CRITICAL_SECTION (self );
5625- res = Pointer_item_lock_held (self , index );
5626- Py_END_CRITICAL_SECTION ();
5627- return res ;
5628- }
5629-
5630- /*[clinic input]
5631- class _ctypes._Pointer "PyObject *" "clinic_state()->PyCPointer_Type"
5632- [clinic start generated code]*/
5633- /*[clinic end generated code: output=da39a3ee5e6b4b0d input=452695db70aa7c3e]*/
5634-
56355632/*[clinic input]
56365633@critical_section
56375634_ctypes._Pointer.__setitem__ as Pointer_ass_item
@@ -5824,7 +5821,7 @@ copy_pointer_to_list_lock_held(PyObject *myself, PyObject *np, Py_ssize_t len,
58245821 Py_ssize_t i ;
58255822 size_t cur ;
58265823 for (cur = start , i = 0 ; i < len ; cur += step , i ++ ) {
5827- PyObject * v = Pointer_item_lock_held (myself , cur );
5824+ PyObject * v = Pointer_item_impl (myself , cur );
58285825 if (!v ) {
58295826 return -1 ;
58305827 }
0 commit comments