@@ -576,8 +576,16 @@ _ctypes_CType_Type___sizeof___impl(PyObject *self, PyTypeObject *cls)
576
576
return PyLong_FromSsize_t (size );
577
577
}
578
578
579
+ /*[clinic input]
580
+ @getter
581
+ @critical_section
582
+ _ctypes.CType_Type.__pointer_type__
583
+
584
+ [clinic start generated code]*/
585
+
579
586
static PyObject *
580
- ctype_get_pointer_type (PyObject * self , void * Py_UNUSED (ignored ))
587
+ _ctypes_CType_Type___pointer_type___get_impl (PyObject * self )
588
+ /*[clinic end generated code: output=718c9ff10b2b0012 input=ff7498aa6edf487c]*/
581
589
{
582
590
ctypes_state * st = get_module_state_by_def (Py_TYPE (self ));
583
591
StgInfo * info ;
@@ -599,8 +607,16 @@ ctype_get_pointer_type(PyObject *self, void *Py_UNUSED(ignored))
599
607
return NULL ;
600
608
}
601
609
610
+ /*[clinic input]
611
+ @setter
612
+ @critical_section
613
+ _ctypes.CType_Type.__pointer_type__
614
+
615
+ [clinic start generated code]*/
616
+
602
617
static int
603
- ctype_set_pointer_type (PyObject * self , PyObject * tp , void * Py_UNUSED (ignored ))
618
+ _ctypes_CType_Type___pointer_type___set_impl (PyObject * self , PyObject * value )
619
+ /*[clinic end generated code: output=6259be8ea21693fa input=9b2dc2400c388982]*/
604
620
{
605
621
ctypes_state * st = get_module_state_by_def (Py_TYPE (self ));
606
622
StgInfo * info ;
@@ -612,7 +628,7 @@ ctype_set_pointer_type(PyObject *self, PyObject *tp, void *Py_UNUSED(ignored))
612
628
return -1 ;
613
629
}
614
630
615
- Py_XSETREF (info -> pointer_type , Py_XNewRef (tp ));
631
+ Py_XSETREF (info -> pointer_type , Py_XNewRef (value ));
616
632
return 0 ;
617
633
}
618
634
@@ -626,8 +642,7 @@ static PyMethodDef ctype_methods[] = {
626
642
};
627
643
628
644
static PyGetSetDef ctype_getsets [] = {
629
- { "__pointer_type__" , ctype_get_pointer_type , ctype_set_pointer_type ,
630
- "pointer type" , NULL },
645
+ _CTYPES_CTYPE_TYPE___POINTER_TYPE___GETSETDEF
631
646
{ NULL , NULL }
632
647
};
633
648
@@ -1254,9 +1269,11 @@ PyCPointerType_SetProto(ctypes_state *st, PyObject *self, StgInfo *stginfo, PyOb
1254
1269
return -1 ;
1255
1270
}
1256
1271
Py_XSETREF (stginfo -> proto , Py_NewRef (proto ));
1272
+ STGINFO_LOCK (info );
1257
1273
if (info -> pointer_type == NULL ) {
1258
1274
Py_XSETREF (info -> pointer_type , Py_NewRef (self ));
1259
1275
}
1276
+ STGINFO_UNLOCK ();
1260
1277
return 0 ;
1261
1278
}
1262
1279
0 commit comments