boost::python handle& operator=() is not implemented correctly
- Linguagem predominante
- C++
- Estrelas
- 537
- Forks
- 223
- Merge médio
- 11h 22min
- PRs com merge (30d)
- 2
Descrição
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.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Locate handle& operator=() in the Boost.Python sources and inspect the reference-counting operations shown in the issue. Verify the assignment behavior for self-assignment and confirm that the reference count remains valid after the operator completes.
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
- 45/100