boostorg / boostorg/python

boost::python handle& operator=() is not implemented correctly

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

描述

The assignment operator for a handle is implemented by first decreasing the reference count of the contained object and then incrementing the one of the right hand side.

```python
python::xdecref(m_p);
m_p = python::xincref(r.m_p);
```

This is not the correct order but should be the other way round, i.e. first incrementing than decrementing. This is also the effect described in the documentation.

```python
python::xincref(r.m_p)
python::xdecref(m_p);
m_p = r.m_p
```

By doing it the current way, self assignment increases the reference count of a potentially already freed object.

贡献指南

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

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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