boostorg / boostorg/python

Strange behavior with ternary operator

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

描述

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?

貢獻指南

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

研究方向

重現提供的 C++ Boost.Python 程式碼片段,並檢查兩個條件值所產生的 Python 型別。判斷對全域變數進行三元指派是預期行為還是 Boost.Python 的 bug;完成標準是記錄說明,或找出需要修正的相關行為。

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

評估

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

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

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