Avoid DeprecationWarning for `_pack_` without `_layout_` when there are not bit-fields?
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug report
Bug description:
New Python versions give a DeprecationWarning for struct definitions that use _pack_ = True but do not specify the _layout_.
In a sense a new feature, but as I believe this is only relevant for bit-fields: wouldn't it make sense to allow leaving _layout_ unspecified when the struct contains no bitfields?
(I suppose that means giving it some default, such as the system native layout.)
The context is just seeing this in NumPy where bit-fields are not used so I was wondering: https://github.com/numpy/numpy/issues/28926.
Adding the _layout_ isn't a problem of course, but if the no-bitfield case is common (not sure) it may be nice to not be forced to "decide" on an irrelevant _layout_ (or act up on the DeprecationWarning)?
Another question that comes to mind is that _layout_ = "native" or so seems potentially useful.
CPython versions tested on:
3.14
Operating systems tested on:
Other
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die DeprecationWarning in Python 3.14 für eine struct-Definition zu reproduzieren, die _pack_ = True ohne _layout_ verwendet, mit Fokus auf den im Bericht beschriebenen Fall ohne Bitfelder. Prüfe das damit zusammenhängende ctypes-Verhalten und das im Bericht verlinkte NumPy-Issue; als erledigt gilt die Aufgabe, wenn ein vereinbarter Layout-Standardwert oder eine klare Entscheidung vorliegt, dass die Warnung weiterhin erforderlich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend
- Issue-Typ
- Bug
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100