Skip to content

PyROOT / cppyy: potentially ineffcicient "member offset" on enumerators #10724

Closed

Description

@Axel-Naumann

Running ROOT.TParameter["char"]().Print() triggers the following backtrace:

#6  0x00007f5aa1508536 in cling::Interpreter::EvaluateInternal (this=0x55c3b6db88f0, 
    input="TParameter<char>::kMultiply;", CO=..., V=0x7ffeae65ef40, wrapPoint=45)
    at /home/axel/build/root/master2/src/interpreter/cling/lib/Interpreter/Interpreter.cpp:1379
#7  0x00007f5aa1506307 in cling::Interpreter::process (this=0x55c3b6db88f0, 
    input="TParameter<char>::kMultiply;", V=0x7ffeae65ef40, T=0x0, disableValuePrinting=false)
    at /home/axel/build/root/master2/src/interpreter/cling/lib/Interpreter/Interpreter.cpp:840
#8  0x00007f5aa175d89a in cling::MetaProcessor::process (this=0x55c3b78351a0, input_line=..., 
    compRes=@0x7ffeae65eefc: cling::Interpreter::kSuccess, result=0x7ffeae65ef40, disableValuePrinting=false)
    at /home/axel/build/root/master2/src/interpreter/cling/lib/MetaProcessor/MetaProcessor.cpp:341
#9  0x00007f5aa12b19c0 in HandleInterpreterException (metaProcessor=0x55c3b78351a0, 
    input_line=0x55c3bb82fd10 "TParameter<char>::kMultiply;", 
    compRes=@0x7ffeae65eefc: cling::Interpreter::kSuccess, result=0x7ffeae65ef40)
    at /home/axel/build/root/master2/src/core/metacling/src/TCling.cxx:2448
#10 0x00007f5aa12b265d in TCling::ProcessLine (this=0x55c3b6cef830, 
    line=0x55c3bb8310e0 "TParameter<char>::kMultiply;", error=0x0)
    at /home/axel/build/root/master2/src/core/metacling/src/TCling.cxx:2608
#11 0x00007f5aa710b936 in Cppyy::GetDatamemberOffset (scope=18, idata=3)
    at /home/axel/build/root/master2/src/bindings/pyroot/cppyy/cppyy-backend/clingwrapper/src/clingwrapper.cxx:1995
#12 0x00007f5aa7288e96 in CPyCppyy::BuildScopeProxyDict (scope=18, pyclass=0x55c3bb8545f0)
    at /home/axel/build/root/master2/src/bindings/pyroot/cppyy/CPyCppyy/src/ProxyWrappers.cxx:353
#13 0x00007f5aa728a648 in CPyCppyy::CreateScopeProxy (name="TParameter<char>", parent=0x55c3b870c0b0)
    at /home/axel/build/root/master2/src/bindings/pyroot/cppyy/CPyCppyy/src/ProxyWrappers.cxx:681
#14 0x00007f5aa7265443 in (anonymous namespace)::MakeCppTemplateClass (args=0x7f5a8ad24ec0)
    at /home/axel/build/root/master2/src/bindings/pyroot/cppyy/CPyCppyy/src/CPyCppyyModule.cxx:368

That seems unnecessary; TClass and friends should know it's an enumerator and should know the value of it.

Activity

  1. pcanal commented on Jun 9, 2022

    @pcanal
    Member

    Currently TParameter<char> does not have a provided dictionary:

    $ rg -g \*LinkDef\* TParameter
    core/base/inc/LinkDef3.h
    266:#pragma link C++ class TParameter<Bool_t>+;
    267:#pragma link C++ class TParameter<Float_t>+;
    268:#pragma link C++ class TParameter<Double_t>+;
    269:#pragma link C++ class TParameter<Int_t>+;
    270:#pragma link C++ class TParameter<Long_t>+;
    271:#pragma link C++ class TParameter<Long64_t>+;
    
  2. Axel-Naumann commented on Jun 9, 2022

    @Axel-Naumann
    MemberAuthor

    I don't think that's relevant to the issue :-) I tried to avoid any type that might have been instantiated already somewhere else, and with TParameter<char> I was positive that's not the case. You could also try with std::vector<TObject******> - if that had an enum member :-)

  3. dpiparo commented on Feb 4, 2024

    @dpiparo
    Member

    This is now

    IncrementalExecutor::executeFunction: symbol '_ZN10TParameterIcE8StreamerER7TBuffer' unresolved while linking symbol '__cf_7'!
    You are probably missing the definition of TParameter<char>::Streamer(TBuffer&)
    Maybe you need to load the corresponding shared library?
    IncrementalExecutor::executeFunction: symbol '_ZN10TParameterIcE5ClassEv' unresolved while linking symbol '__cf_7'!
    You are probably missing the definition of TParameter<char>::Class()
    Maybe you need to load the corresponding shared library?
    
    
  4. vgvassilev commented on Feb 4, 2024

    @vgvassilev
    Member
    #7  0x00007f5aa1506307 in cling::Interpreter::process (this=0x55c3b6db88f0, 
        input="TParameter<char>::kMultiply;", V=0x7ffeae65ef40, T=0x0, disableValuePrinting=false)
        at /home/axel/build/root/master2/src/interpreter/cling/lib/Interpreter/Interpreter.cpp:840
    

    That's practically the same area as #14287 For some reason cppyy does not go via the offset interface...

  5. guitargeek commented on Oct 8, 2026

    @guitargeek
    Contributor

    Original problem fixed by #21261, follow-up reported in #10724 (comment) fixed by #23613. Both fixes were merged in the 6.42 release cycle.

    A regression test that ensures these member offset queries don't go through the interpreter anymore is proposed in CppInterOp:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions