Exposing inherited static member variables as static property with the same name leads to exception
まだ誰も着手していません。
評価
調査の方向性
まず、提供された C++ Boost.Python の例を再現し、exposeDerived 内の add_static_property から失敗を追跡します。同じ名前を持つ継承された静的プロパティがどのように扱われるかを調査します。完了条件は、モジュールが正常に import でき、Base.Name と Derived.Name が別々のままであることです。
索引モデルが issue の本文から書いたものです。
説明
This bug has been reported by Luke Titley in 2009 on boost-build mailing list. It is still reproducible with the version of boost python 1.65 on Visual C++ 2017. I'm using the Luke's code snippet to show the problem.
There are two boost python classes, one inheriting from the other; each with a static member variable of the same name.
//---------------------------------------------------------------------------------------
// C++ Classes
//---------------------------------------------------------------------------------------
class Base
{
public:
static const wstring Name;
};
const wstring Base::Name(L"Base");
//---------------------------------------------------------------------------------------
class Derived : public Base
{
public:
static const wstring Name;
};
const wstring Derived ::Name(L"Derived");
//---------------------------------------------------------------------------------------
// Boost Python Bindings
//---------------------------------------------------------------------------------------
wstring getBaseName()
{
return Base::Name;
}
void exposeBase()
{
py::class_("Base")
.add_static_property("Name", &getBaseName) ;
}
//---------------------------------------------------------------------------------------
wstring getDerivedName()
{
return Derived::Name;
}
void exposeDerived()
{
py::class_<Derived, bases >("Derived")
.add_static_property("Name", &getDerivedName) ;
}
//---------------------------------------------------------------------------------------
BOOST_PYTHON_MODULE(nmx)
{
exposeBase();
exposeDerived();
}
The import of the module fails and it's caused by throwing exception in exposedDerived (add_static_property).
Best Regards,
Gabriel
- 主要言語
- C++
- スター
- 537
- フォーク
- 223
- 平均マージ
- 11時間 22分
- マージ済み PR(30日)
- 2
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/python のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
BoostDetectToolset-1.90.0.cmake file not found in an include() call in boost_python-config.cmake オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
boostorg/python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
duckdb/duckdb-wasm#2258 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
objectionary/eo-graphs#75 ·
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend オープンcoarray
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
FISCO-BCOS/FISCO-BCOS#5642 ·