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

[PyROOT] cppyy selects explicit template instantiation

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

メンテナーはふだん 1 日以内に返信

@guitargeek がすでに取り組んでいます。

2026年2月19日 から。

評価

この issue はまだ評価されていません。

説明

bug in:Python Interface
Check duplicate issues.
  • Checked for duplicates
Description

When a function takes a mandatory template argument that also cannot be deduced, cppyy sometimes uses an explicit instantiation.

Reproducer
>>> import ROOT
>>> ROOT.gInterpreter.Declare("template <typename T> std::size_t get_size() { return sizeof(T); }")
True
>>> ROOT.gInterpreter.Declare("template std::size_t get_size<int>();")
True
>>> ROOT.get_size()
4
>>> ROOT.get_size[""]()
4

I would expect the call to fail:

>>> import ROOT
>>> ROOT.gInterpreter.Declare("template <typename T> std::size_t get_size() { return sizeof(T); }")
True
>>> ROOT.get_size()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Template method resolution failed:
  Failed to instantiate "get_size()"
>>> ROOT.get_size[""]()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Could not find "get_size<>" (set cppyy.set_debug() for C++ errors):
  Failed to instantiate "get_size<>()"

Interestingly, the behavior is different after it failed once:

>>> ROOT.gInterpreter.Declare("template std::size_t get_size<int>();")
True
>>> ROOT.get_size()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Template method resolution failed:
  Failed to instantiate "get_size()"
>>> ROOT.get_size[""]()
4
>>> ROOT.get_size()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Template method resolution failed:
  Failed to instantiate "get_size()"

Now it only works with get_size[""]()...?!

ROOT version

master

Installation method

from source

Operating system

Linux

Additional context

No response

主要言語
C++
スター
3.3k
フォーク
1.6k
平均マージ
2日 7時間
マージ済み PR(30日)
180

環境構築

はじめの一歩

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

root-project/root のほかの issue

root-project/root の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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