boostorg / boostorg/python

warning: missing field 'tp_version_tag' initializer [-Wmissing-field-initializers]

未关闭
#418 0 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
537
派生
223
平均合并
11 小时 22 分钟
30 天内合并 PR
2

描述

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
};
...
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。