8000 gh-117142: ctypes: Unify meta tp slot functions by neonene · Pull Request #117143 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117142: ctypes: Unify meta tp slot functions #117143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 1, 2024
Prev Previous commit
Next Next commit
no return on err (traverse, clear)
  • Loading branch information
neonene committed Mar 25, 2024
commit f3881e6b13691c04835c350ae17ffbf58769130c
7 changes: 3 additions & 4 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,11 @@ static PyType_Spec structparam_spec = {
static int
CType_Type_traverse(PyObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));

ctypes_state *st = GLOBAL_STATE();
if (st && st->PyCType_Type) {
StgInfo *info;
if (PyStgInfo_FromType(st, self, &info) < 0) {
return -1;
PyErr_WriteUnraisable(self);
}
if (info) {
Py_VISIT(info->proto);
Expand All @@ -467,6 +465,7 @@ CType_Type_traverse(PyObject *self, visitproc visit, void *arg)
Py_VISIT(info->checker);
}
}
Py_VISIT(Py_TYPE(self));
return PyType_Type.tp_traverse(self, visit, arg);
}

Expand All @@ -488,7 +487,7 @@ CType_Type_clear(PyObject *self)
if (st && st->PyCType_Type) {
StgInfo *info;
if (PyStgInfo_FromType(st, self, &info) < 0) {
return -1;
PyErr_WriteUnraisable(self);
}
if (info) {
_ctype_clear_stginfo(info);
Expand Down
0