@@ -133,10 +133,8 @@ bytes(cdata)
133133/*[clinic input]
134134module _ctypes
135135class _ctypes.CFuncPtr "PyCFuncPtrObject *" "&PyCFuncPtr_Type"
136- class _ctypes.Array "CDataObject *" "clinic_state()->PyCArray_Type"
137- class _ctypes.Pointer "CDataObject *" "clinic_state()->PyCPointer_Type"
138136[clinic start generated code]*/
139- /*[clinic end generated code: output=da39a3ee5e6b4b0d input=56de8bab30675d93 ]*/
137+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=58e8c99474bc631e ]*/
140138
141139#define clinic_state () (get_module_state_by_class(cls))
142140#define clinic_state_sub () (get_module_state_by_class(cls->tp_base))
@@ -4985,8 +4983,11 @@ static PyType_Spec pycunion_spec = {
49854983/*
49864984 PyCArray_Type
49874985*/
4988- static int Array_ass_item_lock_held (PyObject * , Py_ssize_t , PyObject * );
4989- static int Array_ass_subscript (PyObject * , PyObject * , PyObject * );
4986+
4987+ /*[clinic input]
4988+ class _ctypes.Array "PyObject *" "clinic_state()->PyCArray_Type"
4989+ [clinic start generated code]*/
4990+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=b2d780e2e2dc6e8a]*/
49904991
49914992static int
49924993Array_init (PyObject * self , PyObject * args , PyObject * kw )
@@ -5010,7 +5011,7 @@ Array_init(PyObject *self, PyObject *args, PyObject *kw)
50105011 for (i = 0 ; result >= 0 && i < n ; ++ i ) {
50115012 PyObject * v = PyTuple_GET_ITEM (args , i );
50125013 assert (v != NULL );
5013- result = Array_ass_item_lock_held (self , i , v );
5014+ result = Array_ass_item_impl (self , i , v );
50145015 }
50155016 Py_END_CRITICAL_SECTION ();
50165017 return result ;
@@ -5028,14 +5029,14 @@ Array_init(PyObject *self, PyObject *args, PyObject *kw)
50285029/*[clinic input]
50295030@critical_section
50305031_ctypes.Array.__getitem__ as Array_item
5031- self as myself: self(type="PyObject *")
5032+ myself: self
50325033 index: Py_ssize_t
50335034 /
50345035[clinic start generated code]*/
50355036
50365037static PyObject *
50375038Array_item_impl (PyObject * myself , Py_ssize_t index )
5038- /*[clinic end generated code: output=d038162d727d7d9b input=5979a1200a1397ca ]*/
5039+ /*[clinic end generated code: output=d038162d727d7d9b input=68fa9889c77bb8c9 ]*/
50395040{
50405041 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (myself );
50415042
@@ -5067,14 +5068,14 @@ Array_item_impl(PyObject *myself, Py_ssize_t index)
50675068/*[clinic input]
50685069@critical_section
50695070_ctypes.Array.__getitem__ as Array_subscript
5070- self as myself: self(type="PyObject *")
5071+ myself: self
50715072 item: object
50725073 /
50735074[clinic start generated code]*/
50745075
50755076static PyObject *
50765077Array_subscript_impl (PyObject * myself , PyObject * item )
5077- /*[clinic end generated code: output=5c88d612ad5c8a1a input=1a68b5a5ba349556 ]*/
5078+ /*[clinic end generated code: output=5c88d612ad5c8a1a input=510935495a857cac ]*/
50785079{
50795080 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (myself );
50805081
@@ -5192,8 +5193,19 @@ Array_subscript_impl(PyObject *myself, PyObject *item)
51925193}
51935194
51945195
5196+ /*[clinic input]
5197+ @critical_section
5198+ _ctypes.Array.__setitem__ as Array_ass_item
5199+
5200+ myself: self
5201+ index: Py_ssize_t
5202+ value: object
5203+ /
5204+ [clinic start generated code]*/
5205+
51955206static int
5196- Array_ass_item_lock_held (PyObject * myself , Py_ssize_t index , PyObject * value )
5207+ Array_ass_item_impl (PyObject * myself , Py_ssize_t index , PyObject * value )
5208+ /*[clinic end generated code: output=8fb1fd51b5b45da8 input=8b6ddb53d6377b96]*/
51975209{
51985210 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (myself );
51995211
@@ -5227,19 +5239,19 @@ Array_ass_item_lock_held(PyObject *myself, Py_ssize_t index, PyObject *value)
52275239 index , size , ptr );
52285240}
52295241
5230- static int
5231- Array_ass_item (PyObject * myself , Py_ssize_t index , PyObject * value )
5232- {
5233- int result ;
5234- Py_BEGIN_CRITICAL_SECTION (myself );
5235- result = Array_ass_item_lock_held (myself , index , value );
5236- Py_END_CRITICAL_SECTION ();
5237- return result ;
5238- }
5242+ /*[clinic input]
5243+ @critical_section
5244+ _ctypes.Array.__setitem__ as Array_ass_subscript
52395245
5246+ myself: self
5247+ item: object
5248+ value: object
5249+ /
5250+ [clinic start generated code]*/
52405251
52415252static int
5242- Array_ass_subscript_lock_held (PyObject * myself , PyObject * item , PyObject * value )
5253+ Array_ass_subscript_impl (PyObject * myself , PyObject * item , PyObject * value )
5254+ /*[clinic end generated code: output=cb9a138e4e40c5ac input=4b7aedebbb357853]*/
52435255{
52445256 CDataObject * self = _CDataObject_CAST (myself );
52455257
@@ -5256,7 +5268,7 @@ Array_ass_subscript_lock_held(PyObject *myself, PyObject *item, PyObject *value)
52565268 return -1 ;
52575269 if (i < 0 )
52585270 i += self -> b_length ;
5259- return Array_ass_item_lock_held (myself , i , value );
5271+ return Array_ass_item_impl (myself , i , value );
52605272 }
52615273 else if (PySlice_Check (item )) {
52625274 Py_ssize_t start , stop , step , slicelen , otherlen , i ;
@@ -5281,7 +5293,7 @@ Array_ass_subscript_lock_held(PyObject *myself, PyObject *item, PyObject *value)
52815293 int result ;
52825294 if (item == NULL )
52835295 return -1 ;
5284- result = Array_ass_item_lock_held (myself , cur , item );
5296+ result = Array_ass_item_impl (myself , cur , item );
52855297 Py_DECREF (item );
52865298 if (result == -1 )
52875299 return -1 ;
@@ -5295,17 +5307,6 @@ Array_ass_subscript_lock_held(PyObject *myself, PyObject *item, PyObject *value)
52955307 }
52965308}
52975309
5298- static int
5299- Array_ass_subscript (PyObject * myself , PyObject * item , PyObject * value )
5300- {
5301- int result ;
5302- Py_BEGIN_CRITICAL_SECTION (myself );
5303- result = Array_ass_subscript_lock_held (myself , item , value );
5304- Py_END_CRITICAL_SECTION ();
5305- return result ;
5306- }
5307-
5308-
53095310static Py_ssize_t
53105311Array_length (PyObject * myself )
53115312{
@@ -5574,17 +5575,22 @@ static PyType_Spec pycsimple_spec = {
55745575/*
55755576 PyCPointer_Type
55765577*/
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+
55775583/*[clinic input]
55785584@critical_section
5579- _ctypes.Pointer .__getitem__ as Pointer_item
5580- self as myself: self(type="PyObject *")
5585+ _ctypes._Pointer .__getitem__ as Pointer_item
5586+ myself: self
55815587 index: Py_ssize_t
55825588 /
55835589[clinic start generated code]*/
55845590
55855591static PyObject *
55865592Pointer_item_impl (PyObject * myself , Py_ssize_t index )
5587- /*[clinic end generated code: output=4ae9d566e8038853 input=5e1c027271cdbb9f ]*/
5593+ /*[clinic end generated code: output=4ae9d566e8038853 input=17943427cd04ed08 ]*/
55885594{
55895595 CDataObject * self = _CDataObject_CAST (myself );
55905596 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (self );
@@ -5623,8 +5629,19 @@ Pointer_item_impl(PyObject *myself, Py_ssize_t index)
56235629 index , size , (char * )((char * )deref + offset ));
56245630}
56255631
5632+ /*[clinic input]
5633+ @critical_section
5634+ _ctypes._Pointer.__setitem__ as Pointer_ass_item
5635+
5636+ myself: self
5637+ index: Py_ssize_t
5638+ value: object
5639+ /
5640+ [clinic start generated code]*/
5641+
56265642static int
5627- Pointer_ass_item_lock_held (PyObject * myself , Py_ssize_t index , PyObject * value )
5643+ Pointer_ass_item_impl (PyObject * myself , Py_ssize_t index , PyObject * value )
5644+ /*[clinic end generated code: output=4503430bd55b6c69 input=344ad19b3094558c]*/
56285645{
56295646 CDataObject * self = _CDataObject_CAST (myself );
56305647 _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (self );
@@ -5669,16 +5686,6 @@ Pointer_ass_item_lock_held(PyObject *myself, Py_ssize_t index, PyObject *value)
56695686 index , size , ((char * )deref + offset ));
56705687}
56715688
5672- static int
5673- Pointer_ass_item (PyObject * self , Py_ssize_t index , PyObject * value )
5674- {
5675- int res ;
5676- Py_BEGIN_CRITICAL_SECTION (self );
5677- res = Pointer_ass_item_lock_held (self , index , value );
5678- Py_END_CRITICAL_SECTION ();
5679- return res ;
5680- }
5681-
56825689static PyObject *
56835690Pointer_get_contents_lock_held (PyObject * self , void * closure )
56845691{
0 commit comments