@@ -3277,10 +3277,9 @@ PyObject *
32773277PyCData_get (ctypes_state * st , PyObject * type , GETFUNC getfunc , PyObject * src ,
32783278 Py_ssize_t index , Py_ssize_t size , char * adr )
32793279{
3280- CDataObject * cdata = _CDataObject_CAST (src );
32813280 if (getfunc ) {
32823281 PyObject * res ;
3283- Py_BEGIN_CRITICAL_SECTION (cdata );
3282+ Py_BEGIN_CRITICAL_SECTION (src );
32843283 res = getfunc (adr , size );
32853284 Py_END_CRITICAL_SECTION ();
32863285 return res ;
@@ -3292,7 +3291,7 @@ PyCData_get(ctypes_state *st, PyObject *type, GETFUNC getfunc, PyObject *src,
32923291 }
32933292 if (info && info -> getfunc && !_ctypes_simple_instance (st , type )) {
32943293 PyObject * res ;
3295- Py_BEGIN_CRITICAL_SECTION (cdata );
3294+ Py_BEGIN_CRITICAL_SECTION (src );
32963295 res = info -> getfunc (adr , size );
32973296 Py_END_CRITICAL_SECTION ();
32983297 return res ;
@@ -5401,16 +5400,11 @@ Pointer_item_lock_held(PyObject *myself, Py_ssize_t index)
54015400}
54025401
54035402static PyObject *
5404- Pointer_item (PyObject * myself , Py_ssize_t index )
5403+ Pointer_item (PyObject * self , Py_ssize_t index )
54055404{
5406- CDataObject * self = _CDataObject_CAST (myself );
54075405 PyObject * res ;
5408- // TODO: The plan is to make Py_BEGIN_CRITICAL_SECTION() a mutex instead of a critical
5409- // section someday, so when that happens, this needs to get refactored
5410- // to be re-entrant safe.
5411- // This goes for all the locks here.
54125406 Py_BEGIN_CRITICAL_SECTION (self );
5413- res = Pointer_item_lock_held (myself , index );
5407+ res = Pointer_item_lock_held (self , index );
54145408 Py_END_CRITICAL_SECTION ();
54155409 return res ;
54165410}
@@ -5461,12 +5455,11 @@ Pointer_ass_item_lock_held(PyObject *myself, Py_ssize_t index, PyObject *value)
54615455}
54625456
54635457static int
5464- Pointer_ass_item (PyObject * myself , Py_ssize_t index , PyObject * value )
5458+ Pointer_ass_item (PyObject * self , Py_ssize_t index , PyObject * value )
54655459{
5466- CDataObject * self = _CDataObject_CAST (myself );
54675460 int res ;
54685461 Py_BEGIN_CRITICAL_SECTION (self );
5469- res = Pointer_ass_item_lock_held (myself , index , value );
5462+ res = Pointer_ass_item_lock_held (self , index , value );
54705463 Py_END_CRITICAL_SECTION ();
54715464 return res ;
54725465}
@@ -5492,12 +5485,11 @@ Pointer_get_contents_lock_held(PyObject *self, void *closure)
54925485}
54935486
54945487static PyObject *
5495- Pointer_get_contents (PyObject * myself , void * closure )
5488+ Pointer_get_contents (PyObject * self , void * closure )
54965489{
5497- CDataObject * self = _CDataObject_CAST (myself );
54985490 PyObject * res ;
54995491 Py_BEGIN_CRITICAL_SECTION (self );
5500- res = Pointer_get_contents_lock_held (myself , closure );
5492+ res = Pointer_get_contents_lock_held (self , closure );
55015493 Py_END_CRITICAL_SECTION ();
55025494 return res ;
55035495}
0 commit comments