-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[cppyy] fix: instantiation of templated functions #19450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[cppyy] fix: instantiation of templated functions #19450
Conversation
@siliataider, @vepadulano, You might be interested in this. |
Very nice. @Vipul-Cariappa would you mind perhaps adding a test? |
Test Results 21 files 21 suites 3d 9h 30m 50s ⏱️ For more details on these failures, see this check. Results for commit db169ce. ♻️ This comment has been updated with latest results. |
dfbe8ab
to
8e00338
Compare
Done.
…On Wed, Jul 23, 2025 at 9:35 PM Danilo Piparo ***@***.***> wrote:
*dpiparo* left a comment (root-project/root#19450)
<#19450 (comment)>
Very nice. @Vipul-Cariappa <https://github.com/Vipul-Cariappa> would you
mind perhaps adding a test?
—
Reply to this email directly, view it on GitHub
<#19450 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANI5JBO57FYSLS35HWWVIHD3J7PYFAVCNFSM6AAAAACCGDYPP6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMBZHA4TGMJXHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
void baz(T a, U b, std::string c) { std::cout << "baz(" << a << "," << b << ",\"" << c << "\")\n"; } | ||
|
||
template<typename F, typename... Args> | ||
bool dataframe_define_mock(F callable, Args&&... args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would give this function a more generic name, not to confuse it with a specific feature
void foo() { std::cout << "foo!\n";} | ||
|
||
void bar(int a, float b) { std::cout << "bar(" << a << "," << b << ")\n"; } | ||
|
||
template <typename T, typename U> | ||
void baz(T a, U b, std::string c) { std::cout << "baz(" << a << "," << b << ",\"" << c << "\")\n"; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we've seen that in certain cases the function was called in a way that seemed correct but wasn't, I would actually return values from each of these functions, not using std::cout
. The values can just be std::tuple
of the input arguments returned as-is. The values should be checked on the Python side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, since a std::tuple might incur in other issues, it's enough to return something like T
with T
being the integer passed as function argument.
@@ -142,6 +142,12 @@ PyObject* TemplateProxy::Instantiate(const std::string& fname, | |||
} else | |||
PyErr_Clear(); | |||
|
|||
if (!bArgSet && Py_IS_TYPE(itemi, &TemplateProxy_Type)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the error
Py_IS_TYPE was not declared in this scope
On Alma8, maybe it's a missing macro from the Python version of that node?
8e00338
to
6f6bf91
Compare
when instantiating with another templated function
6f6bf91
to
db169ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
When instantiating with another templated function