/*[clinic input]
@getter
-@critical_section
_ctypes.CType_Type.__pointer_type__
[clinic start generated code]*/
static PyObject *
_ctypes_CType_Type___pointer_type___get_impl(PyObject *self)
-/*[clinic end generated code: output=718c9ff10b2b0012 input=ff7498aa6edf487c]*/
+/*[clinic end generated code: output=718c9ff10b2b0012 input=ad12dc835943ceb8]*/
{
ctypes_state *st = get_module_state_by_def(Py_TYPE(self));
StgInfo *info;
PyErr_Format(PyExc_TypeError, "%R must have storage info", self);
return NULL;
}
-
- if (info->pointer_type) {
- return Py_NewRef(info->pointer_type);
+ PyObject *pointer_type;
+ STGINFO_LOCK(info);
+ pointer_type = Py_XNewRef(info->pointer_type);
+ STGINFO_UNLOCK();
+ if (pointer_type) {
+ return pointer_type;
}
PyErr_Format(PyExc_AttributeError,
/*[clinic input]
@setter
-@critical_section
_ctypes.CType_Type.__pointer_type__
[clinic start generated code]*/
static int
_ctypes_CType_Type___pointer_type___set_impl(PyObject *self, PyObject *value)
-/*[clinic end generated code: output=6259be8ea21693fa input=9b2dc2400c388982]*/
+/*[clinic end generated code: output=6259be8ea21693fa input=a05055fc7f4714b6]*/
{
ctypes_state *st = get_module_state_by_def(Py_TYPE(self));
StgInfo *info;
PyErr_Format(PyExc_TypeError, "%R must have storage info", self);
return -1;
}
-
+ STGINFO_LOCK(info);
Py_XSETREF(info->pointer_type, Py_XNewRef(value));
+ STGINFO_UNLOCK();
return 0;
}
static PyObject *
_ctypes_CType_Type___pointer_type___get(PyObject *self, void *Py_UNUSED(context))
{
- PyObject *return_value = NULL;
-
- Py_BEGIN_CRITICAL_SECTION(self);
- return_value = _ctypes_CType_Type___pointer_type___get_impl(self);
- Py_END_CRITICAL_SECTION();
-
- return return_value;
+ return _ctypes_CType_Type___pointer_type___get_impl(self);
}
#if !defined(_ctypes_CType_Type___pointer_type___DOCSTR)
{
int return_value;
- Py_BEGIN_CRITICAL_SECTION(self);
return_value = _ctypes_CType_Type___pointer_type___set_impl(self, value);
- Py_END_CRITICAL_SECTION();
return return_value;
}
}
return Simple_from_outparm_impl(self, cls);
}
-/*[clinic end generated code: output=f4bc2a77ec073b8a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=536c9bcf4e05913e input=a9049054013a1b77]*/