@@ -5179,15 +5179,21 @@ PyCArrayType_from_ctype(ctypes_state *st, PyObject *itemtype, Py_ssize_t length)
5179
5179
*/
5180
5180
5181
5181
/*[clinic input]
5182
- class _ctypes.Simple "PyObject *" "clinic_state()->Simple_Type"
5182
+ class _ctypes.Simple "CDataObject *" "clinic_state()->Simple_Type"
5183
+ [clinic start generated code]*/
5184
+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=e0493451fecf8cd4]*/
5185
+
5186
+ /*[clinic input]
5187
+ @critical_section
5188
+ @setter
5189
+ _ctypes.Simple.value
5183
5190
[clinic start generated code]*/
5184
- /*[clinic end generated code: output=da39a3ee5e6b4b0d input=016c476c7aa8b8a8]*/
5185
5191
5186
5192
static int
5187
- Simple_set_value (PyObject * op , PyObject * value , void * Py
8000
_UNUSED (ignored ))
5193
+ _ctypes_Simple_value_set_impl (CDataObject * self , PyObject * value )
5194
+ /*[clinic end generated code: output=f267186118939863 input=977af9dc9e71e857]*/
5188
5195
{
5189
5196
PyObject * result ;
5190
- CDataObject * self = _CDataObject_CAST (op );
5191
5197
5192
5198
if (value == NULL ) {
5193
5199
PyErr_SetString (PyExc_TypeError ,
@@ -5197,54 +5203,57 @@ Simple_set_value(PyObject *op, PyObject *value, void *Py_UNUSED(ignored))
5197
5203
5198
5204
ctypes_state * st = get_module_state_by_def (Py_TYPE (Py_TYPE (self )));
5199
5205
StgInfo * info ;
5200
- if (PyStgInfo_FromObject (st , op , & info ) < 0 ) {
5206
+ if (PyStgInfo_FromObject (st , ( PyObject * ) self , & info ) < 0 ) {
5201
5207
return -1 ;
5202
5208
}
5203
5209
assert (info ); /* Cannot be NULL for CDataObject instances */
5204
5210
assert (info -> setfunc );
5205
5211
5206
- LOCK_PTR (self );
5207
5212
result = info -> setfunc (self -> b_ptr , value , info -> size );
5208
- UNLOCK_PTR (self );
5209
5213
if (!result )
5210
5214
return -1 ;
5211
5215
5212
5216
/* consumes the refcount the setfunc returns */
5213
5217
return KeepRef (self , 0 , result );
5214
5218
}
5215
5219
5220
+
5216
5221
static int
5217
5222
Simple_init (PyObject * self , PyObject * args , PyObject * kw )
5218
5223
{
5219
5224
PyObject * value = NULL ;
5220
5225
if (!PyArg_UnpackTuple (args , "__init__" , 0 , 1 , & value ))
5221
5226
return -1 ;
5222
5227
if (value )
5223
- return Simple_set_value (self , value , NULL );
5228
+ return _ctypes_Simple_value_set (self , value , NULL );
5224
5229
return 0 ;
5225
5230
}
5226
5231
5232
+
5233
+ /*[clinic input]
5234
+ @critical_section
5235
+ @getter
5236
+ _ctypes.Simple.value
5237
+ [clinic start generated code]*/
5238
+
5227
5239
static PyObject *
5228
- Simple_get_value (PyObject * op , void * Py_UNUSED (ignored ))
5240
+ _ctypes_Simple_value_get_impl (CDataObject * self )
5241
+ /*[clinic end generated code: output=ce5a26570830a243 input=3ed3f735cec89282]*/
5229
5242
{
5230
- CDataObject * self = _CDataObject_CAST (op );
5231
5243
ctypes_state * st = get_module_state_by_def (Py_TYPE (Py_TYPE (self )));
5232
5244
StgInfo * info ;
5233
- if (PyStgInfo_FromObject (st , op , & info ) < 0 ) {
5245
+ if (PyStgInfo_FromObject (st , ( PyObject * ) self , & info ) < 0 ) {
5234
5246
return NULL ;
5235
5247
}
5236
5248
assert (info ); /* Cannot be NULL for CDataObject instances */
5237
5249
assert (info -> getfunc );
5238
5250
PyObject * res ;
5239
- LOCK_PTR (self );
5240
5251
res = info -> getfunc (self -> b_ptr , self -> b_size );
5241
- UNLOCK_PTR (self );
5242
5252
return res ;
5243
5253
}
5244
5254
5245
5255
static PyGetSetDef Simple_getsets [] = {
5246
- { "value" , Simple_get_value , Simple_set_value ,
5247
- "current value" , NULL },
5256
+ _CTYPES_SIMPLE_VALUE_GETSETDEF
5248
5257
{ NULL , NULL }
5249
5258
};
5250
5259
@@ -5265,7 +5274,7 @@ Simple_from_outparm_impl(PyObject *self, PyTypeObject *cls)
5265
5274
return Py_NewRef (self );
5266
5275
}
5267
5276
/* call stginfo->getfunc */
5268
- return Simple_get_value (self , NULL );
5277
+ return _ctypes_Simple_value_get (self , NULL );
5269
5278
}
5270
5279
5271
5280
static PyMethodDef Simple_methods [] = {
@@ -5296,7 +5305,7 @@ Simple_repr(PyObject *self)
5296
5305
Py_TYPE (self )-> tp_name , self );
5297
5306
}
5298
5307
5299
- val = Simple_get_value (self , NULL );
5308
+ val = _ctypes_Simple_value_get (self , NULL );
5300
5309
if (val == NULL )
5301
5310
return NULL ;
5302
5311