Skip to content
Snippets Groups Projects
Commit 413bd994 authored by Enric Tejedor Saavedra's avatar Enric Tejedor Saavedra
Browse files

[ROOT-9809] Only invoke Python C API if Python is initialized

If libPyROOT is loaded with gSystem->Load, the static
initialization block in TMemoryRegulator.cxx is executed and
ends up invoking PyCFunction_New, which causes a crash from
Python 3.7. The crash is due to Python not being initialized.
This also happens when using TPython from C++, since Python
has not	been initialized when TPython is used.

Note that when loading libPyROOT from ROOT.py, which is what
happens when someone uses PyROOT, the Python interpreter already
exists and is initialized, so invoking PyCFunction_New does not
crash.

This fix moves the creation of gObjectEraseCallback away from
the static block in TMemoryRegulator in order to prevent the
issue described above.
parent 17d499c1
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment