boostorg / boostorg/python

Strange behavior with ternary operator

Aberta
#493 3 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
C++
Estrelas
537
Forks
223
Merge médio
11h 22min
PRs com merge (30d)
2

Descrição

I noticed strange behavior while trying to use ternary operator with `boost::python::dict` and `list`.
I'm trying to do something like this
```cpp
using py = boost::python;

py::dict globals;
py::dict dict;
py::list list;
bool condition = true;
globals["mol"] = condition ? dict : list;
py::exec("print(type(mol))", globals);
```

What I expected: `` or ``
What I got: ``

Is it expected behavior? Then can someone explain me why?
Or this is a bug?

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Reproduce the provided C++ Boost.Python snippet and inspect the resulting Python type for both condition values. Determine whether the ternary assignment to globals is expected behavior or a Boost.Python bug; done means documenting the explanation or identifying the relevant behavior to fix.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
cpp
Domínio
api, backend
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.