gh-99284: [ctypes] remove _use_broken_old_ctypes_structure_semantics_ (GH-99285)

It was untested and undocumented. No code has been found in the wild that ever used it.
This commit is contained in:
Nikita Sobolev 2022-11-19 09:25:32 +03:00 • committed by GitHub
parent 27d8dc2c9d
commit a3360facba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 27 deletions

View file

@ -356,14 +356,6 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
int big_endian;
int arrays_seen = 0;
/* HACK Alert: I cannot be bothered to fix ctypes.com, so there has to
be a way to use the old, broken semantics: _fields_ are not extended
but replaced in subclasses.
XXX Remove this in ctypes 1.0!
*/
int use_broken_old_ctypes_semantics;
if (fields == NULL)
return 0;
@ -378,19 +370,6 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
big_endian = PY_BIG_ENDIAN;
}
if (_PyObject_LookupAttr(type,
&_Py_ID(_use_broken_old_ctypes_structure_semantics_), &tmp) < 0)
{
return -1;
}
if (tmp) {
Py_DECREF(tmp);
use_broken_old_ctypes_semantics = 1;
}
else {
use_broken_old_ctypes_semantics = 0;
}
if (_PyObject_LookupAttr(type, &_Py_ID(_pack_), &tmp) < 0) {
return -1;
}
@ -454,7 +433,7 @@ PyCStructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct
if (!isStruct) {
stgdict->flags |= TYPEFLAG_HASUNION;
}
if (basedict && !use_broken_old_ctypes_semantics) {
if (basedict) {
size = offset = basedict->size;
align = basedict->align;
union_size = 0;