@@ -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,6 +607,17 @@ 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
+
617
+ static int
618
+ _ctypes_CType_Type___pointer_type___set_impl (PyObject * self , PyObject * value )
619
+ /*[clinic end generated code: output=6259be8ea21693fa input=9b2dc2400c388982]*/
620
+
602
621
static int
603
622
ctype_set_pointer_type (PyObject * self , PyObject * tp , void * Py_UNUSED (ignored ))
604
623
{
@@ -626,8 +645,7 @@ static PyMethodDef ctype_methods[] = {
626
645
};
627
646
628
647
static PyGetSetDef ctype_getsets [] = {
629
- { "__pointer_type__" , ctype_get_pointer_type , ctype_set_pointer_type ,
630
- "pointer type" , NULL },
648
+ _CTYPES_CTYPE_TYPE___POINTER_TYPE___GETSETDEF
631
649
{ NULL , NULL }
632
650
};
633
651
@@ -1254,9 +1272,11 @@ PyCPointerType_SetProto(ctypes_state *st, PyObject *self, StgInfo *stginfo, PyOb
1254
1272
return -1 ;
1255
1273
}
1256
1274
Py_XSETREF (stginfo -> proto , Py_NewRef (proto ));
1275
+ STGINFO_LOCK (info );
1257
1276
if (info -> pointer_type == NULL ) {
1258
1277
Py_XSETREF (info -> pointer_type , Py_NewRef (self ));
1259
1278
}
1279
+ STGINFO_UNLOCK ();
1260
1280
return 0 ;
1261
1281
}
1262
1282
0 commit comments