boostorg / boostorg/python

Extends dict key error

Offen
#245 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
537
Forks
223
Ø Merge
11 Std. 22 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.