boostorg / boostorg/python

Extends dict key error

未關閉
#245 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
537
分支
223
平均合併
11 小時 22 分鐘
30 天內合併 PR
2

描述

I have written two snippets, with cpp and python

```c++
#include
#include
#include

using namespace boost::python;

struct testdict : public boost::python::dict {
testdict()
{
std::cout << "constructor" << std::endl;
}

virtual ~testdict()
{
std::cout << "destructor" << std::endl;
}
};

BOOST_PYTHON_MODULE(boost) {
class_>("testdict");
};
```

```python
#!/usr/bin/python3
# coding=utf-8

import boost

data = boost.testdict()

data['key'] = 1

print(data)
print('key' in data)
```

compile cpp code and run python code the output is not expected

```
constructor
{'key': 1}
False
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Reproduce the behavior from the C++ BOOST_PYTHON_MODULE(testdict) entry point and the Python expressions data['key'] = 1 and 'key' in data. Read the boost::python::dict inheritance and wrapping behavior to determine why assignment and membership disagree. Done means the intended dict semantics are established and the reported mismatch is fixed or clearly documented.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
cpp, python
領域
backend
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。