// @(#)root/pyroot:$Id$
// Author: Wim Lavrijsen, Apr 2004

// Bindings
#include "PyROOT.h"
#include "PyStrings.h"
#include "TPython.h"
#include "ObjectProxy.h"
#include "MethodProxy.h"
#include "RootWrapper.h"
#include "TPyClassGenerator.h"

// ROOT
#include "TROOT.h"
#include "TClassRef.h"
#include "TObject.h"

// Standard
#include <stdio.h>
#include <Riostream.h>
#include <string>

//______________________________________________________________________________
//                          Python interpreter access
//                          =========================
//
// The TPython class allows for access to python objects from Cling. The current
// functionality is only basic: ROOT objects and builtin types can freely cross
// the boundary between the two interpreters, python objects can be instantiated
// and their methods can be called. All other cross-coding is based on strings
// that are run on the python interpreter.
//
// Examples:
//
//  $ cat MyPyClass.py
//  print 'creating class MyPyClass ... '
//
//  class MyPyClass:
//     def __init__( self ):
//        print 'in MyPyClass.__init__'
//
//     def gime( self, what ):
//        return what
//
//  $ root -l
//  // Execute a string of python code.
//  root [0] TPython::Exec( "print \'Hello World!\'" );
//  Hello World!
//
//  // Create a TBrowser on the python side, and transfer it back and forth.
//  // Note the required explicit (void*) cast!
//  root [1] TBrowser* b = (void*)TPython::Eval( "ROOT.TBrowser()" );
//  root [2] TPython::Bind( b, "b" );
//  root [3] b == (void*) TPython::Eval( "b" )
//  (int)1
//
//  // Builtin variables can cross-over by using implicit casts.
//  root [4] int i = TPython::Eval( "1 + 1" );
//  root [5] i
//  (int)2
//
//  // Load a python module with a class definition, and use it. Casts are
//  // necessary as the type information can not be otherwise derived.
//  root [6] TPython::LoadMacro( "MyPyClass.py" );
//  creating class MyPyClass ...
//  root [7] MyPyClass m;
//  in MyPyClass.__init__
//  root [8] std::string s = (char*)m.gime( "aap" );
//  root [9] s
//  (class TString)"aap"
//
// It is possible to switch between interpreters by calling "TPython::Prompt()"
// on the Cling side, while returning with ^D (EOF). State is preserved between
// successive switches.
//
// The API part provides (direct) C++ access to the bindings functionality of
// PyROOT. It allows verifying that you deal with a PyROOT python object in the
// first place (ObjectProxy_Check for ObjectProxy and any derived types, as well
// as ObjectProxy_CheckExact for ObjectProxy's only); and it allows conversions
// of void* to an ObjectProxy and vice versa.


//- data ---------------------------------------------------------------------
ClassImp(TPython)
static PyObject* gMainDict = 0;

namespace PyROOT {
   R__EXTERN PyObject* gRootModule;
}


//- static public members ----------------------------------------------------
Bool_t TPython::Initialize()
{
// Private initialization method: setup the python interpreter and load the
// ROOT module.

   static Bool_t isInitialized = kFALSE;
   if ( isInitialized )
      return kTRUE;

   if ( ! Py_IsInitialized() ) {
   // this happens if Cling comes in first
      PyEval_InitThreads();
      Py_Initialize();

   // try again to see if the interpreter is initialized
      if ( ! Py_IsInitialized() ) {
      // give up ...
         std::cerr << "Error: python has not been intialized; returning." << std::endl;
         return kFALSE;
      }

   // set the command line arguments on python's sys.argv
#if PY_VERSION_HEX < 0x03000000
      char* argv[] = { const_cast< char* >( "root" ) };
#else
      wchar_t* argv[] = { const_cast< wchar_t* >( L"root" ) };
#endif
      PySys_SetArgv( sizeof(argv)/sizeof(argv[0]), argv );

   // force loading of the ROOT module
      PyRun_SimpleString( const_cast< char* >( "import ROOT" ) );
   }

   if ( ! gMainDict ) {
   // retrieve the main dictionary
      gMainDict = PyModule_GetDict(
         PyImport_AddModule( const_cast< char* >( "__main__" ) ) );
      Py_INCREF( gMainDict );
   }

// python side class construction, managed by ROOT
   gROOT->AddClassGenerator( new TPyClassGenerator );

// declare success ...
   isInitialized = kTRUE;
   return kTRUE;
}

//____________________________________________________________________________
Bool_t TPython::Import( const char* mod_name )
{
// Import the named python module and create Cling equivalents for its classes
// and methods.

// setup
   if ( ! Initialize() )
      return kFALSE;

   PyObject* mod = PyImport_ImportModule( mod_name );
   if ( ! mod ) {
      PyErr_Print();
      return kFALSE;
   }

// allow finding to prevent creation of a python proxy for the C++ proxy
   Py_INCREF( mod );
   PyModule_AddObject( PyROOT::gRootModule, mod_name, mod );

// force creation of the module as a namespace
   TClass::GetClass( mod_name, kTRUE );

   PyObject* dct = PyModule_GetDict( mod );

// create Cling classes for all new python classes
   PyObject* values = PyDict_Values( dct );
   for ( int i = 0; i < PyList_GET_SIZE( values ); ++i ) {
      PyObject* value = PyList_GET_ITEM( values, i );
      Py_INCREF( value );

   // collect classes
      if ( PyClass_Check( value ) || PyObject_HasAttr( value, PyROOT::PyStrings::gBases ) ) {
      // get full class name (including module)
         PyObject* pyClName  = PyObject_GetAttr( value, PyROOT::PyStrings::gName );

         if ( PyErr_Occurred() )
            PyErr_Clear();

      // build full, qualified name
         std::string fullname = mod_name;
         fullname += ".";
         fullname += PyROOT_PyUnicode_AsString( pyClName );

      // force class creation (this will eventually call TPyClassGenerator)
         TClass::GetClass( fullname.c_str(), kTRUE );

         Py_XDECREF( pyClName );
      }

      Py_DECREF( value );
   }

   Py_DECREF( values );

// TODO: mod "leaks" here
   if ( PyErr_Occurred() )
      return kFALSE;
   return kTRUE;
}

//____________________________________________________________________________
void TPython::LoadMacro( const char* name )
{
// Execute the give python script as if it were a macro (effectively an
// execfile in __main__), and create Cling equivalents for any newly available
// python classes.

// setup
   if ( ! Initialize() )
      return;

// obtain a reference to look for new classes later
   PyObject* old = PyDict_Values( gMainDict );

// actual execution
   Exec( (std::string( "execfile(\"" ) + name + "\")").c_str() );

// obtain new __main__ contents
   PyObject* current = PyDict_Values( gMainDict );

// create Cling classes for all new python classes
   for ( int i = 0; i < PyList_GET_SIZE( current ); ++i ) {
      PyObject* value = PyList_GET_ITEM( current, i );
      Py_INCREF( value );

      if ( ! PySequence_Contains( old, value ) ) {
      // collect classes
         if ( PyClass_Check( value ) || PyObject_HasAttr( value, PyROOT::PyStrings::gBases ) ) {
         // get full class name (including module)
            PyObject* pyModName = PyObject_GetAttr( value, PyROOT::PyStrings::gModule );
            PyObject* pyClName  = PyObject_GetAttr( value, PyROOT::PyStrings::gName );

            if ( PyErr_Occurred() )
               PyErr_Clear();

         // need to check for both exact and derived (differences exist between older and newer
         // versions of python ... bug?)
            if ( (pyModName && pyClName) &&\
                 ( (PyBytes_CheckExact( pyModName ) && PyBytes_CheckExact( pyClName )) ||\
                   (PyBytes_Check( pyModName ) && PyBytes_Check( pyClName ))\
                 ) ) {
            // build full, qualified name
               std::string fullname = PyROOT_PyUnicode_AsString( pyModName );
               fullname += '.';
               fullname += PyROOT_PyUnicode_AsString( pyClName );

            // force class creation (this will eventually call TPyClassGenerator)
               TClass::GetClass( fullname.c_str(), kTRUE );
            }

            Py_XDECREF( pyClName );
            Py_XDECREF( pyModName );
         }
      }

      Py_DECREF( value );
   }

   Py_DECREF( current );
   Py_DECREF( old );
}

//____________________________________________________________________________
void TPython::ExecScript( const char* name, int argc, const char**
#if PY_VERSION_HEX < 0x03000000
       argv
#endif
   )
{
// Execute a python stand-alone script, with argv CLI arguments.
//
// example of use:
//    const char* argv[] = { "1", "2", "3" };
//    TPython::ExecScript( "test.py", sizeof(argv)/sizeof(argv[0]), argv );


// setup
   if ( ! Initialize() )
      return;

// verify arguments
   if ( ! name ) {
      std::cerr << "Error: no file name specified." << std::endl;
      return;
   }

   FILE* fp = fopen( name, "r" );
   if ( ! fp ) {
      std::cerr << "Error: could not open file \"" << name << "\"." << std::endl;
      return;
   }

// store a copy of the old cli for restoration
   PyObject* oldargv = PySys_GetObject( const_cast< char* >( "argv" ) );   // borrowed
   if ( ! oldargv )                               // e.g. apache
      PyErr_Clear();
   else {
      PyObject* l = PyList_New( PyList_GET_SIZE( oldargv ) );
      for ( int i = 0; i < PyList_GET_SIZE( oldargv ); ++i ) {
         PyObject* item = PyList_GET_ITEM( oldargv, i );
         Py_INCREF( item );
         PyList_SET_ITEM( l, i, item );           // steals ref
      }
      oldargv = l;
   }

// create and set (add progam name) the new command line
   argc += 1;
#if PY_VERSION_HEX < 0x03000000
   const char** argv2 = new const char*[ argc ];
   for ( int i = 1; i < argc; ++i ) argv2[ i ] = argv[ i-1 ];
   argv2[ 0 ] = Py_GetProgramName();
   PySys_SetArgv( argc, const_cast< char** >( argv2 ) );
   delete [] argv2;
#else
// TODO: fix this to work like above ...
#endif

// actual script execution
   PyObject* gbl = PyDict_Copy( gMainDict );
   PyObject* result =   // PyRun_FileEx closes fp (b/c of last argument "1")
      PyRun_FileEx( fp, const_cast< char* >( name ), Py_file_input, gbl, gbl, 1 );
   if ( ! result )
      PyErr_Print();
   Py_XDECREF( result );
   Py_DECREF( gbl );

// restore original command line
   if ( oldargv ) {
      PySys_SetObject( const_cast< char* >( "argv" ), oldargv );
      Py_DECREF( oldargv );
   }
}

//____________________________________________________________________________
Bool_t TPython::Exec( const char* cmd )
{
// Execute a python statement (e.g. "import ROOT").

// setup
   if ( ! Initialize() )
      return kFALSE;

// execute the command
   PyObject* result =
      PyRun_String( const_cast< char* >( cmd ), Py_file_input, gMainDict, gMainDict );

// test for error
   if ( result ) {
      Py_DECREF( result );
      return kTRUE;
   } else {
      PyErr_Print();
      return kFALSE;
   }
}


//____________________________________________________________________________
const TPyReturn TPython::Eval( const char* expr )
{
// Evaluate a python expression (e.g. "ROOT.TBrowser()").
//
// Caution: do not hold on to the return value: either store it in a builtin
// type (implicit casting will work), or in a pointer to a ROOT object (explicit
// casting to a void* is required).

// setup
   if ( ! Initialize() )
      return TPyReturn();

// evaluate the expression
   PyObject* result =
      PyRun_String( const_cast< char* >( expr ), Py_eval_input, gMainDict, gMainDict );

// report errors as appropriate; return void
   if ( ! result ) {
      PyErr_Print();
      return TPyReturn();
   }

// results that require no convserion
   if ( result == Py_None || PyROOT::ObjectProxy_Check( result ) ||
         PyBytes_Check( result ) ||
         PyFloat_Check( result ) || PyLong_Check( result ) || PyInt_Check( result ) )
      return TPyReturn( result );

// explicit conversion for python type required
   PyObject* pyclass = PyObject_GetAttr( result, PyROOT::PyStrings::gClass );
   if ( pyclass != 0 ) {
   // retrieve class name and the module in which it resides
      PyObject* name = PyObject_GetAttr( pyclass, PyROOT::PyStrings::gName );
      PyObject* module = PyObject_GetAttr( pyclass, PyROOT::PyStrings::gModule );

   // concat name
      std::string qname =
         std::string( PyROOT_PyUnicode_AsString( module ) ) + '.' + PyROOT_PyUnicode_AsString( name );
      Py_DECREF( module );
      Py_DECREF( name );
      Py_DECREF( pyclass );

   // locate ROOT style class with this name
      TClass* klass = TClass::GetClass( qname.c_str() );

   // construct general ROOT python object that pretends to be of class 'klass'
      if ( klass != 0 )
         return TPyReturn( result );
   } else
      PyErr_Clear();

// no conversion, return null pointer object
   Py_DECREF( result );
   return TPyReturn();
}

//____________________________________________________________________________
Bool_t TPython::Bind( TObject* object, const char* label )
{
// Bind a ROOT object with, at the python side, the name "label".

// check given address and setup
   if ( ! ( object && Initialize() ) )
      return kFALSE;

// bind object in the main namespace
   TClass* klass = object->IsA();
   if ( klass != 0 ) {
      PyObject* bound = PyROOT::BindCppObject( (void*)object, klass->GetName() );

      if ( bound ) {
         Bool_t bOk = PyDict_SetItemString( gMainDict, const_cast< char* >( label ), bound ) == 0;
         Py_DECREF( bound );

         return bOk;
      }
   }

   return kFALSE;
}

//____________________________________________________________________________
void TPython::Prompt() {
// Enter an interactive python session (exit with ^D). State is preserved
// between successive calls.

// setup
   if ( ! Initialize() ) {
      return;
   }

// enter i/o interactive mode
   PyRun_InteractiveLoop( stdin, const_cast< char* >( "\0" ) );
}

//____________________________________________________________________________
Bool_t TPython::ObjectProxy_Check( PyObject* pyobject )
{
// Test whether the type of the given pyobject is of ObjectProxy type or any
// derived type.

// setup
   if ( ! Initialize() )
      return kFALSE;

// detailed walk through inheritance hierarchy
   return PyROOT::ObjectProxy_Check( pyobject );
}

//____________________________________________________________________________
Bool_t TPython::ObjectProxy_CheckExact( PyObject* pyobject )
{
// Test whether the type of the given pyobject is ObjectProxy type.

// setup
   if ( ! Initialize() )
      return kFALSE;

// direct pointer comparison of type member
   return PyROOT::ObjectProxy_CheckExact( pyobject );
}

//____________________________________________________________________________
Bool_t TPython::MethodProxy_Check( PyObject* pyobject )
{
// Test whether the type of the given pyobject is of MethodProxy type or any
// derived type.

// setup
   if ( ! Initialize() )
      return kFALSE;

// detailed walk through inheritance hierarchy
   return PyROOT::MethodProxy_Check( pyobject );
}

//____________________________________________________________________________
Bool_t TPython::MethodProxy_CheckExact( PyObject* pyobject )
{
// Test whether the type of the given pyobject is MethodProxy type.

// setup
   if ( ! Initialize() )
      return kFALSE;

// direct pointer comparison of type member
   return PyROOT::MethodProxy_CheckExact( pyobject );
}

//____________________________________________________________________________
void* TPython::ObjectProxy_AsVoidPtr( PyObject* pyobject )
{
// Extract the object pointer held by the ObjectProxy pyobject.

// setup
   if ( ! Initialize() )
      return 0;

// check validity of cast
   if ( ! PyROOT::ObjectProxy_Check( pyobject ) )
      return 0;

// get held object (may be null)
   return ((PyROOT::ObjectProxy*)pyobject)->GetObject();
}

//____________________________________________________________________________
PyObject* TPython::ObjectProxy_FromVoidPtr(
   void* addr, const char* classname, Bool_t python_owns )
{
// Bind the addr to a python object of class defined by classname.

// setup
   if ( ! Initialize() )
      return 0;

// perform cast (the call will check TClass and addr, and set python errors)
   PyObject* pyobject = PyROOT::BindCppObjectNoCast( addr, Cppyy::GetScope( classname ), kFALSE );

// give ownership, for ref-counting, to the python side, if so requested
   if ( python_owns && PyROOT::ObjectProxy_Check( pyobject ) )
      ((PyROOT::ObjectProxy*)pyobject)->HoldOn();

   return pyobject;
}
 TPython.cxx:1
 TPython.cxx:2
 TPython.cxx:3
 TPython.cxx:4
 TPython.cxx:5
 TPython.cxx:6
 TPython.cxx:7
 TPython.cxx:8
 TPython.cxx:9
 TPython.cxx:10
 TPython.cxx:11
 TPython.cxx:12
 TPython.cxx:13
 TPython.cxx:14
 TPython.cxx:15
 TPython.cxx:16
 TPython.cxx:17
 TPython.cxx:18
 TPython.cxx:19
 TPython.cxx:20
 TPython.cxx:21
 TPython.cxx:22
 TPython.cxx:23
 TPython.cxx:24
 TPython.cxx:25
 TPython.cxx:26
 TPython.cxx:27
 TPython.cxx:28
 TPython.cxx:29
 TPython.cxx:30
 TPython.cxx:31
 TPython.cxx:32
 TPython.cxx:33
 TPython.cxx:34
 TPython.cxx:35
 TPython.cxx:36
 TPython.cxx:37
 TPython.cxx:38
 TPython.cxx:39
 TPython.cxx:40
 TPython.cxx:41
 TPython.cxx:42
 TPython.cxx:43
 TPython.cxx:44
 TPython.cxx:45
 TPython.cxx:46
 TPython.cxx:47
 TPython.cxx:48
 TPython.cxx:49
 TPython.cxx:50
 TPython.cxx:51
 TPython.cxx:52
 TPython.cxx:53
 TPython.cxx:54
 TPython.cxx:55
 TPython.cxx:56
 TPython.cxx:57
 TPython.cxx:58
 TPython.cxx:59
 TPython.cxx:60
 TPython.cxx:61
 TPython.cxx:62
 TPython.cxx:63
 TPython.cxx:64
 TPython.cxx:65
 TPython.cxx:66
 TPython.cxx:67
 TPython.cxx:68
 TPython.cxx:69
 TPython.cxx:70
 TPython.cxx:71
 TPython.cxx:72
 TPython.cxx:73
 TPython.cxx:74
 TPython.cxx:75
 TPython.cxx:76
 TPython.cxx:77
 TPython.cxx:78
 TPython.cxx:79
 TPython.cxx:80
 TPython.cxx:81
 TPython.cxx:82
 TPython.cxx:83
 TPython.cxx:84
 TPython.cxx:85
 TPython.cxx:86
 TPython.cxx:87
 TPython.cxx:88
 TPython.cxx:89
 TPython.cxx:90
 TPython.cxx:91
 TPython.cxx:92
 TPython.cxx:93
 TPython.cxx:94
 TPython.cxx:95
 TPython.cxx:96
 TPython.cxx:97
 TPython.cxx:98
 TPython.cxx:99
 TPython.cxx:100
 TPython.cxx:101
 TPython.cxx:102
 TPython.cxx:103
 TPython.cxx:104
 TPython.cxx:105
 TPython.cxx:106
 TPython.cxx:107
 TPython.cxx:108
 TPython.cxx:109
 TPython.cxx:110
 TPython.cxx:111
 TPython.cxx:112
 TPython.cxx:113
 TPython.cxx:114
 TPython.cxx:115
 TPython.cxx:116
 TPython.cxx:117
 TPython.cxx:118
 TPython.cxx:119
 TPython.cxx:120
 TPython.cxx:121
 TPython.cxx:122
 TPython.cxx:123
 TPython.cxx:124
 TPython.cxx:125
 TPython.cxx:126
 TPython.cxx:127
 TPython.cxx:128
 TPython.cxx:129
 TPython.cxx:130
 TPython.cxx:131
 TPython.cxx:132
 TPython.cxx:133
 TPython.cxx:134
 TPython.cxx:135
 TPython.cxx:136
 TPython.cxx:137
 TPython.cxx:138
 TPython.cxx:139
 TPython.cxx:140
 TPython.cxx:141
 TPython.cxx:142
 TPython.cxx:143
 TPython.cxx:144
 TPython.cxx:145
 TPython.cxx:146
 TPython.cxx:147
 TPython.cxx:148
 TPython.cxx:149
 TPython.cxx:150
 TPython.cxx:151
 TPython.cxx:152
 TPython.cxx:153
 TPython.cxx:154
 TPython.cxx:155
 TPython.cxx:156
 TPython.cxx:157
 TPython.cxx:158
 TPython.cxx:159
 TPython.cxx:160
 TPython.cxx:161
 TPython.cxx:162
 TPython.cxx:163
 TPython.cxx:164
 TPython.cxx:165
 TPython.cxx:166
 TPython.cxx:167
 TPython.cxx:168
 TPython.cxx:169
 TPython.cxx:170
 TPython.cxx:171
 TPython.cxx:172
 TPython.cxx:173
 TPython.cxx:174
 TPython.cxx:175
 TPython.cxx:176
 TPython.cxx:177
 TPython.cxx:178
 TPython.cxx:179
 TPython.cxx:180
 TPython.cxx:181
 TPython.cxx:182
 TPython.cxx:183
 TPython.cxx:184
 TPython.cxx:185
 TPython.cxx:186
 TPython.cxx:187
 TPython.cxx:188
 TPython.cxx:189
 TPython.cxx:190
 TPython.cxx:191
 TPython.cxx:192
 TPython.cxx:193
 TPython.cxx:194
 TPython.cxx:195
 TPython.cxx:196
 TPython.cxx:197
 TPython.cxx:198
 TPython.cxx:199
 TPython.cxx:200
 TPython.cxx:201
 TPython.cxx:202
 TPython.cxx:203
 TPython.cxx:204
 TPython.cxx:205
 TPython.cxx:206
 TPython.cxx:207
 TPython.cxx:208
 TPython.cxx:209
 TPython.cxx:210
 TPython.cxx:211
 TPython.cxx:212
 TPython.cxx:213
 TPython.cxx:214
 TPython.cxx:215
 TPython.cxx:216
 TPython.cxx:217
 TPython.cxx:218
 TPython.cxx:219
 TPython.cxx:220
 TPython.cxx:221
 TPython.cxx:222
 TPython.cxx:223
 TPython.cxx:224
 TPython.cxx:225
 TPython.cxx:226
 TPython.cxx:227
 TPython.cxx:228
 TPython.cxx:229
 TPython.cxx:230
 TPython.cxx:231
 TPython.cxx:232
 TPython.cxx:233
 TPython.cxx:234
 TPython.cxx:235
 TPython.cxx:236
 TPython.cxx:237
 TPython.cxx:238
 TPython.cxx:239
 TPython.cxx:240
 TPython.cxx:241
 TPython.cxx:242
 TPython.cxx:243
 TPython.cxx:244
 TPython.cxx:245
 TPython.cxx:246
 TPython.cxx:247
 TPython.cxx:248
 TPython.cxx:249
 TPython.cxx:250
 TPython.cxx:251
 TPython.cxx:252
 TPython.cxx:253
 TPython.cxx:254
 TPython.cxx:255
 TPython.cxx:256
 TPython.cxx:257
 TPython.cxx:258
 TPython.cxx:259
 TPython.cxx:260
 TPython.cxx:261
 TPython.cxx:262
 TPython.cxx:263
 TPython.cxx:264
 TPython.cxx:265
 TPython.cxx:266
 TPython.cxx:267
 TPython.cxx:268
 TPython.cxx:269
 TPython.cxx:270
 TPython.cxx:271
 TPython.cxx:272
 TPython.cxx:273
 TPython.cxx:274
 TPython.cxx:275
 TPython.cxx:276
 TPython.cxx:277
 TPython.cxx:278
 TPython.cxx:279
 TPython.cxx:280
 TPython.cxx:281
 TPython.cxx:282
 TPython.cxx:283
 TPython.cxx:284
 TPython.cxx:285
 TPython.cxx:286
 TPython.cxx:287
 TPython.cxx:288
 TPython.cxx:289
 TPython.cxx:290
 TPython.cxx:291
 TPython.cxx:292
 TPython.cxx:293
 TPython.cxx:294
 TPython.cxx:295
 TPython.cxx:296
 TPython.cxx:297
 TPython.cxx:298
 TPython.cxx:299
 TPython.cxx:300
 TPython.cxx:301
 TPython.cxx:302
 TPython.cxx:303
 TPython.cxx:304
 TPython.cxx:305
 TPython.cxx:306
 TPython.cxx:307
 TPython.cxx:308
 TPython.cxx:309
 TPython.cxx:310
 TPython.cxx:311
 TPython.cxx:312
 TPython.cxx:313
 TPython.cxx:314
 TPython.cxx:315
 TPython.cxx:316
 TPython.cxx:317
 TPython.cxx:318
 TPython.cxx:319
 TPython.cxx:320
 TPython.cxx:321
 TPython.cxx:322
 TPython.cxx:323
 TPython.cxx:324
 TPython.cxx:325
 TPython.cxx:326
 TPython.cxx:327
 TPython.cxx:328
 TPython.cxx:329
 TPython.cxx:330
 TPython.cxx:331
 TPython.cxx:332
 TPython.cxx:333
 TPython.cxx:334
 TPython.cxx:335
 TPython.cxx:336
 TPython.cxx:337
 TPython.cxx:338
 TPython.cxx:339
 TPython.cxx:340
 TPython.cxx:341
 TPython.cxx:342
 TPython.cxx:343
 TPython.cxx:344
 TPython.cxx:345
 TPython.cxx:346
 TPython.cxx:347
 TPython.cxx:348
 TPython.cxx:349
 TPython.cxx:350
 TPython.cxx:351
 TPython.cxx:352
 TPython.cxx:353
 TPython.cxx:354
 TPython.cxx:355
 TPython.cxx:356
 TPython.cxx:357
 TPython.cxx:358
 TPython.cxx:359
 TPython.cxx:360
 TPython.cxx:361
 TPython.cxx:362
 TPython.cxx:363
 TPython.cxx:364
 TPython.cxx:365
 TPython.cxx:366
 TPython.cxx:367
 TPython.cxx:368
 TPython.cxx:369
 TPython.cxx:370
 TPython.cxx:371
 TPython.cxx:372
 TPython.cxx:373
 TPython.cxx:374
 TPython.cxx:375
 TPython.cxx:376
 TPython.cxx:377
 TPython.cxx:378
 TPython.cxx:379
 TPython.cxx:380
 TPython.cxx:381
 TPython.cxx:382
 TPython.cxx:383
 TPython.cxx:384
 TPython.cxx:385
 TPython.cxx:386
 TPython.cxx:387
 TPython.cxx:388
 TPython.cxx:389
 TPython.cxx:390
 TPython.cxx:391
 TPython.cxx:392
 TPython.cxx:393
 TPython.cxx:394
 TPython.cxx:395
 TPython.cxx:396
 TPython.cxx:397
 TPython.cxx:398
 TPython.cxx:399
 TPython.cxx:400
 TPython.cxx:401
 TPython.cxx:402
 TPython.cxx:403
 TPython.cxx:404
 TPython.cxx:405
 TPython.cxx:406
 TPython.cxx:407
 TPython.cxx:408
 TPython.cxx:409
 TPython.cxx:410
 TPython.cxx:411
 TPython.cxx:412
 TPython.cxx:413
 TPython.cxx:414
 TPython.cxx:415
 TPython.cxx:416
 TPython.cxx:417
 TPython.cxx:418
 TPython.cxx:419
 TPython.cxx:420
 TPython.cxx:421
 TPython.cxx:422
 TPython.cxx:423
 TPython.cxx:424
 TPython.cxx:425
 TPython.cxx:426
 TPython.cxx:427
 TPython.cxx:428
 TPython.cxx:429
 TPython.cxx:430
 TPython.cxx:431
 TPython.cxx:432
 TPython.cxx:433
 TPython.cxx:434
 TPython.cxx:435
 TPython.cxx:436
 TPython.cxx:437
 TPython.cxx:438
 TPython.cxx:439
 TPython.cxx:440
 TPython.cxx:441
 TPython.cxx:442
 TPython.cxx:443
 TPython.cxx:444
 TPython.cxx:445
 TPython.cxx:446
 TPython.cxx:447
 TPython.cxx:448
 TPython.cxx:449
 TPython.cxx:450
 TPython.cxx:451
 TPython.cxx:452
 TPython.cxx:453
 TPython.cxx:454
 TPython.cxx:455
 TPython.cxx:456
 TPython.cxx:457
 TPython.cxx:458
 TPython.cxx:459
 TPython.cxx:460
 TPython.cxx:461
 TPython.cxx:462
 TPython.cxx:463
 TPython.cxx:464
 TPython.cxx:465
 TPython.cxx:466
 TPython.cxx:467
 TPython.cxx:468
 TPython.cxx:469
 TPython.cxx:470
 TPython.cxx:471
 TPython.cxx:472
 TPython.cxx:473
 TPython.cxx:474
 TPython.cxx:475
 TPython.cxx:476
 TPython.cxx:477
 TPython.cxx:478
 TPython.cxx:479
 TPython.cxx:480
 TPython.cxx:481
 TPython.cxx:482
 TPython.cxx:483
 TPython.cxx:484
 TPython.cxx:485
 TPython.cxx:486
 TPython.cxx:487
 TPython.cxx:488
 TPython.cxx:489
 TPython.cxx:490
 TPython.cxx:491
 TPython.cxx:492
 TPython.cxx:493
 TPython.cxx:494
 TPython.cxx:495
 TPython.cxx:496
 TPython.cxx:497
 TPython.cxx:498
 TPython.cxx:499
 TPython.cxx:500
 TPython.cxx:501
 TPython.cxx:502
 TPython.cxx:503
 TPython.cxx:504
 TPython.cxx:505
 TPython.cxx:506
 TPython.cxx:507
 TPython.cxx:508
 TPython.cxx:509
 TPython.cxx:510
 TPython.cxx:511
 TPython.cxx:512
 TPython.cxx:513
 TPython.cxx:514
 TPython.cxx:515
 TPython.cxx:516
 TPython.cxx:517
 TPython.cxx:518
 TPython.cxx:519
 TPython.cxx:520
 TPython.cxx:521
 TPython.cxx:522
 TPython.cxx:523
 TPython.cxx:524
 TPython.cxx:525
 TPython.cxx:526
 TPython.cxx:527
 TPython.cxx:528
 TPython.cxx:529
 TPython.cxx:530
 TPython.cxx:531
 TPython.cxx:532
 TPython.cxx:533
 TPython.cxx:534
 TPython.cxx:535
 TPython.cxx:536
 TPython.cxx:537
 TPython.cxx:538
 TPython.cxx:539
 TPython.cxx:540
 TPython.cxx:541
 TPython.cxx:542
 TPython.cxx:543
 TPython.cxx:544
 TPython.cxx:545