@@ -243,7 +243,7 @@ _pack_legacy_size(CFieldObject *field)
243
243
}
244
244
245
245
static int
246
- PyCField_set (PyObject * op , PyObject * inst , PyObject * value )
246
+ PyCField_set_lock_held (PyObject * op , PyObject * inst , PyObject * value )
247
247
{
248
248
CDataObject * dst ;
249
249
char * ptr ;
@@ -265,6 +265,16 @@ PyCField_set(PyObject *op, PyObject *inst, PyObject *value)
265
265
self -> index , _pack_legacy_size (self ), ptr );
266
266
}
267
267
268
+ static int
269
+ PyCField_set (PyObject * op , PyObject * inst , PyObject * value )
270
+ {
271
+ int res ;
272
+ Py_BEGIN_CRITICAL_SECTION (inst );
273
+ res = PyCField_set_lock_held (op , inst , value );
274
+ Py_END_CRITICAL_SECTION ();
275
+ return res ;
276
+ }
277
+
268
278
static PyObject *
269
279
PyCField_get (PyObject * op , PyObject * inst , PyObject * type )
270
280
{
@@ -280,9 +290,13 @@ PyCField_get(PyObject *op, PyObject *inst, PyObject *type)
280
290
return NULL ;
281
291
}
282
292
src = _CDataObject_CAST (inst );
283
- return PyCData_get (st , self -> proto , self -> getfunc , inst ,
293
+ PyObject * res ;
294
+ Py_BEGIN_CRITICAL_SECTION (inst );
295
+ res = PyCData_get (st , self -> proto , self -> getfunc , inst ,
284
296
self -> index , _pack_legacy_size (self ),
285
297
src -> b_ptr + self -> byte_offset );
298
+ Py_END_CRITICAL_SECTION ();
299
+ return res ;
286
300
}
287
301
288
302
static PyObject *
0 commit comments