mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-31490: Fix an assertion failure in ctypes in case an _anonymous_ attr is defined only outside _fields_. (#3615)
This commit is contained in:
parent
a6bb313c70
commit
30b61b51e0
3 changed files with 25 additions and 1 deletions
|
@ -302,7 +302,15 @@ MakeAnonFields(PyObject *type)
|
|||
Py_DECREF(anon_names);
|
||||
return -1;
|
||||
}
|
||||
assert(Py_TYPE(descr) == &PyCField_Type);
|
||||
if (Py_TYPE(descr) != &PyCField_Type) {
|
||||
PyErr_Format(PyExc_AttributeError,
|
||||
"'%U' is specified in _anonymous_ but not in "
|
||||
"_fields_",
|
||||
fname);
|
||||
Py_DECREF(anon_names);
|
||||
Py_DECREF(descr);
|
||||
return -1;
|
||||
}
|
||||
descr->anonymous = 1;
|
||||
|
||||
/* descr is in the field descriptor. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue