Skip to content

Error pickling derived class in PyROOT #8438

@etejedor

Description

@etejedor

Describe the bug

Reported in https://root-forum.cern.ch/t/new-pyroot-cant-pickle-derived-class-types/45415

Expected behavior

That the derived class is pickled without error / a proper error message appears.

To Reproduce

In Derived.py:

import ROOT

class Derived(ROOT.TH1F):
    def __reduce__(self):
        return (self.__class__, ())

In test.py:

from Derived import Derived
import pickle
pickle.dumps(Derived())

Running test.py throws a segfault in the __reduce__ implementation:

#7  0x00007f6aeb43a8ac in TClass::StreamerTObject(TClass const*, void*, TBuffer&, TClass const*) () from /home/vpadulan/Programs/rootproject/rootinstall/v6-24-00/lib/libCore.so
#8  0x00007f6aeaaba5a6 in TBufferFile::WriteObjectClass(void const*, TClass const*, bool) () from /home/vpadulan/Programs/rootproject/rootinstall/v6-24-00/lib/libRIO.so
#9  0x00007f6aeaac1b74 in TBufferIO::WriteObjectAny(void const*, TClass const*, bool) () from /home/vpadulan/Programs/rootproject/rootinstall/v6-24-00/lib/libRIO.so
#10 0x00007f6add1ca55f in op_reduce(CPyCppyy::CPPInstance*, _object*) () from /home/vpadulan/Programs/rootproject/rootinstall/v6-24-00/lib/libROOTPythonizations3_8.so
#11 0x00007f6af8cab364 in cfunction_vectorcall_NOARGS () from /lib64/libpython3.8.so.1.0
#12 0x00007f6af8cb58e4 in PyVectorcall_Call () from /lib64/libpython3.8.so.1.0
#13 0x00007f6aeb6c8bf5 in CPyCppyy::im_call(_object*, _object*, _object*) () from /home/vpadulan/Programs/rootproject/rootinstall/v6-24-00/lib/libcppyy3_8.so

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions