I’ve got a compileable macro library that I can load in ROOT by doing “.L t2x.C+”, and I can access it in a PyROOT script using ROOT.gROOT.ProcessLine(".L t2x.C+"); ROOT.t2x.foo.
I just noticed however that if I try to tab-complete ROOT.t2x to see what classes, functions, and variables are available, I get a massive crash of ROOT and the Python interpreter. Even my Terminal.app (on Mac OSX 10.9) ends up semi-broken, where pressing enter no longer adds a newline and commands typed in don’t appear on the command line.
Here’s the crash printout:
jfcaron@dhcp-128-189-75-219:~/Projects/Proto2BeamTest2$ ipython
import Python 2.7.6 (default, Nov 19 2013, 19:15:05)
Type "copyright", "credits" or "license" for more information.
IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import ROOT
In [2]: ROOT.gROOT.ProcessLine(".L t2x.C+")
Out[2]: 0L
In [3]: ROOT.t2x.
*** Break *** segmentation violation
Generating stack trace...
0x000000010db580cf in PyROOT::(anonymous namespace)::pp_get(PyROOT::PropertyProxy*, PyROOT::ObjectProxy*, _object*) (in libPyROOT.so) + 79
0x000000010db5ae37 in PyROOT::(anonymous namespace)::pt_getattro(_object*, _object*) (in libPyROOT.so) + 39
0x000000010c8ecc98 in builtin_hasattr (in Python) + 136
0x000000010c8f2010 in PyEval_EvalFrameEx (in Python) + 7712
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8830c6 in function_call (in Python) + 342
0x000000010c85f665 in PyObject_Call (in Python) + 101
0x000000010c86b7b6 in instancemethod_call (in Python) + 182
0x000000010c85f665 in PyObject_Call (in Python) + 101
0x000000010c8f40b4 in PyEval_EvalFrameEx (in Python) + 16068
0x000000010c8f6ed2 in fast_function (in Python) + 194
0x000000010c8f328b in PyEval_EvalFrameEx (in Python) + 12443
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8830c6 in function_call (in Python) + 342
0x000000010c85f665 in PyObject_Call (in Python) + 101
0x000000010c86b7b6 in instancemethod_call (in Python) + 182
0x000000010c85f665 in PyObject_Call (in Python) + 101
0x000000010c85f7f3 in PyObject_CallFunction (in Python) + 291
0x000000010da767a2 in on_completion (in readline.so) + 82
0x000000010da83743 in rl_completion_matches (in readline.so) + 99
0x000000010da82a6b in gen_completion_matches (in readline.so) + 123
0x000000010da808d7 in rl_complete_internal (in readline.so) + 327
0x000000010da80743 in rl_complete (in readline.so) + 147
0x000000010da780e2 in _rl_dispatch_subseq (in readline.so) + 530
0x000000010da77b6e in _rl_dispatch (in readline.so) + 46
0x000000010da77acb in readline_internal_char (in readline.so) + 443
0x000000010da99294 in rl_callback_read_char (in readline.so) + 1028
0x000000010da76511 in call_readline (in readline.so) + 369
0x000000010c856c03 in PyOS_Readline (in Python) + 179
0x000000010c8ee002 in builtin_raw_input (in Python) + 434
0x000000010c8f2010 in PyEval_EvalFrameEx (in Python) + 7712
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8f6f36 in fast_function (in Python) + 294
0x000000010c8f328b in PyEval_EvalFrameEx (in Python) + 12443
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8f6f36 in fast_function (in Python) + 294
0x000000010c8f328b in PyEval_EvalFrameEx (in Python) + 12443
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8f6f36 in fast_function (in Python) + 294
0x000000010c8f328b in PyEval_EvalFrameEx (in Python) + 12443
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8f6f36 in fast_function (in Python) + 294
0x000000010c8f328b in PyEval_EvalFrameEx (in Python) + 12443
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8830c6 in function_call (in Python) + 342
0x000000010c85f665 in PyObject_Call (in Python) + 101
0x000000010c8f44e6 in PyEval_EvalFrameEx (in Python) + 17142
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8f6f36 in fast_function (in Python) + 294
0x000000010c8f328b in PyEval_EvalFrameEx (in Python) + 12443
0x000000010c8f0076 in PyEval_EvalCodeEx (in Python) + 1734
0x000000010c8ef9a6 in PyEval_EvalCode (in Python) + 54
0x000000010c917611 in PyRun_FileExFlags (in Python) + 161
0x000000010c91715e in PyRun_SimpleFileExFlags (in Python) + 718
0x000000010c92b002 in Py_Main (in Python) + 3314
0x00007fff967f85fd in start (in libdyld.dylib) + 1
jfcaron@dhcp-128-189-75-219:~/Projects/Proto2BeamTest2$ jfcaron@dhcp-128-189-75-219:~/Projects/Proto2BeamTest2$
and the t2x.C file in question (along with other dependent files) live here: http://bazaar.launchpad.net/~jfcaron/+junk/Proto2BeamTest2/view/head:/t2x.C
I’m ok with tab-completion not working, because I know PyROOT does this lazy-loading thing, but it probably shouldn’t crash this hard.
Jean-François