boostorg / boostorg/python

Extends dict key error

Aperta
#245 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
537
Fork
223
Merge medio
11h 22m
PR unite (30g)
2

Descrizione

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
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.