Avoid DeprecationWarning for `_pack_` without `_layout_` when there are not bit-fields?
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece reproduzindo a DeprecationWarning no Python 3.14 para uma definição de struct que use _pack_ = True sem _layout_, concentrando-se no caso sem campos de bits descrito no relatório. Revise o comportamento relacionado de ctypes e o issue do NumPy vinculado no relatório; a conclusão exige um valor padrão de layout acordado ou uma decisão clara de que o aviso continua sendo necessário.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- backend
- Tipo de issue
- Bug
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100