warning: missing field 'tp_version_tag' initializer [-Wmissing-field-initializers]
- Linguagem predominante
- C++
- Estrelas
- 537
- Forks
- 223
- Merge médio
- 11h 22min
- PRs com merge (30d)
- 2
Descrição
Hi,
using Clang 14/15/16 (-Wall -Wpedantic -Wextra) with Boost 1.81.0 and Python 3.11, I get the following warning at
```
In file included from /my/project/Source.hpp:xx:
In file included from /path/to/boost/1.81.0/include/boost/python.hpp:48:
/path/to/boost/1.81.0/include/boost/python/opaque_pointer_converter.hpp:169:1: warning: missing field 'tp_version_tag' initializer [-Wmissing-field-initializers]
```
Having a closer look, it seems that when defining a `PyTypeObject`, at `.../include/boost/python/opaque_pointer_converter.hpp`, the code isn't considering the last few data members:
```c++
// from .../include/python3.11/cpython/object.h
...
struct _typeobject {
...
PyObject *tp_weaklist;
destructor tp_del;
/* Type attribute cache version tag. Added in version 2.6 */
unsigned int tp_version_tag;
destructor tp_finalize;
vectorcallfunc tp_vectorcall;
};
...
```
```c++
// from .../include/boost/python/opaque_pointer_converter.hpp
...
template
PyTypeObject opaque::type_object =
{
...
0, /* tp_weaklist */
#if PYTHON_API_VERSION >= 1012
0 /* tp_del */
#endif
};
...
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Start in include/boost/python/opaque_pointer_converter.hpp at the opaque::type_object initializer, and compare its fields with cpython/object.h for Python 3.11. Reproduce the warning with Clang and the listed warning flags, then verify that the initializer no longer emits the missing-field-initializers warning.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- cpp, python
- Domínio
- backend
- Tipo de issue
- Bug
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 50/100