Skip to content
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

cppyy no aggregate initialization constructor #16469

Closed
1 task done
m-fila opened this issue Sep 19, 2024 · 2 comments · Fixed by #16338
Closed
1 task done

cppyy no aggregate initialization constructor #16469

m-fila opened this issue Sep 19, 2024 · 2 comments · Fixed by #16338
Assignees
Milestone

Comments

@m-fila
Copy link

m-fila commented Sep 19, 2024

Check duplicate issues.

  • Checked for duplicates

Description

Python bindings done with ROOT's cppyy lack the aggregate initialization constructor

>>> import ROOT
>>> ROOT.gInterpreter.ProcessLine("struct Foo {float x,y,z;};")
0
>>> ROOT.Foo(1,2,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: none of the 3 overloaded methods succeeded. Full details:
  Foo::Foo(Foo&&) =>
    TypeError: takes at most 1 arguments (3 given)
  Foo::Foo() =>
    TypeError: takes at most 0 arguments (3 given)
  Foo::Foo(const Foo&) =>
    TypeError: takes at most 1 arguments (3 given)
>>> print(ROOT.Foo.__init__.__doc__)
Foo::Foo(Foo&&)
Foo::Foo()
Foo::Foo(const Foo&)

same errors when directly using cppyy shipped with ROOT.

But the same code run with the stock cppyy taken from pip works fine

>>> import cppyy
>>> cppyy.__version__
'3.1.2'
>>> cppyy.cppdef("struct Foo {float x,y,z;};")
True
>>> cppyy.gbl.Foo(1,2,3)
<cppyy.gbl.Foo object at 0x59dc0cbddc50>
>>> print(cppyy.gbl.Foo.__init__.__doc__)
Foo::Foo(Foo&&)
Foo::Foo()
Foo::Foo(const Foo&)
void __cppyy_internal::init_Foo(Foo*& self, const float& x = 0, const float& y = 0, const float& z = 0)

Reproducer

import ROOT
ROOT.gInterpreter.ProcessLine("struct Foo {float x,y,z;};")
ROOT.Foo(1,2,3)
print(ROOT.Foo.__init__.__doc__)

ROOT version

Built for linuxx8664gcc on Sep 09 2024, 22:50:44
From heads/master@tags/v6-32-04

Installation method

LCG dev4 nightly

Operating system

almalinux9

Additional context

No response

@aaronj0
Copy link
Collaborator

aaronj0 commented Sep 19, 2024

The support for aggregate constructors is linked to enabling the pythonization currently disabled by this patch.

Landing #16338 should fix this issue.

Copy link

Hi @guitargeek, @aaronj0,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely,
🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Issues
Development

Successfully merging a pull request may close this issue.

3 participants