[ctypes] Do we still need `_use_broken_old_ctypes_structure_semantics_`?
While working on https://github.com/python/cpython/pull/99283 I've noticed this piece of code: https://github.com/python/cpython/blob/0124b5dd28eff7bb80eb7244e97e402a036db13b/Modules/_ctypes/stgdict.c#L360-L364 https://github.com/python/cpython/blob/0124b5dd28eff7bb80eb7244e97e402a036db13b/Modules/_ctypes/stgdict.c#L382-L383
I've never seen this before, so I went and searched for this on the internet: https://cs.github.com/?scopeName=All+repos&scope=&q=use_broken_old_ctypes_structure_semantics
Looks like not a single GitHub project uses it.
Where is that used inside?
» ag _use_broken_old_ctypes_structure_semantics_
Tools/c-analyzer/cpython/globals-to-fix.tsv
761:Modules/_ctypes/stgdict.c PyCStructUnionType_update_stgdict PyId__use_broken_old_ctypes_structure_semantics_ -
Include/internal/pycore_global_strings.h
253: STRUCT_FOR_ID(_use_broken_old_ctypes_structure_semantics_)
Include/internal/pycore_runtime_init_generated.h
762: INIT_ID(_use_broken_old_ctypes_structure_semantics_), \
1879: string = &_Py_ID(_use_broken_old_ctypes_structure_semantics_);
5734: if (Py_REFCNT((PyObject *)&_Py_ID(_use_broken_old_ctypes_structure_semantics_)) < _PyObject_IMMORTAL_REFCNT) {
5735: _PyObject_Dump((PyObject *)&_Py_ID(_use_broken_old_ctypes_structure_semantics_));
Modules/_ctypes/stgdict.c
383: &_Py_ID(_use_broken_old_ctypes_structure_semantics_), &tmp) < 0)
Basically in only one place (and generate code). No docs, no tests. No issues: https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+use_broken_old_ctypes_structure_semantics
And it feels like a python2 era thing. I think it is time to remove it.
PR is on its way, so we can discuss the changes in more details. CC @pitrou as the original author.
- PR: gh-99285