Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Exposing inherited static member variables as static property with the same name leads to exception

オープン
#192 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp, python
領域
api

調査の方向性

まず、提供された 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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

boostorg/python のほかの issue

boostorg/python の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。