<commit_before>// @(#)root/pyroot:$Id$
// Author: <NAME>, Jan 2005

// Bindings
#include "PyROOT.h"
#include "PyStrings.h"
#include "Executors.h"
#include "ObjectProxy.h"
#include "TPyBufferFactory.h"
#include "RootWrapper.h"
#include "Utility.h"

// ROOT
#include "TClassEdit.h"           // for ShortType and CleanType
#include "TInterpreter.h"         // for by-value returns
#include "TInterpreterValue.h"    // id.

// Standard
#include <cstring>
#include <utility>
#include <sstream>


//- data ______________________________________________________________________
namespace PyROOT {

   typedef TExecutor* (*ExecutorFactory_t) ();
   typedef std::map< std::string, ExecutorFactory_t > ExecFactories_t;
   ExecFactories_t gExecFactories;

   R__EXTERN PyObject* gNullPtrObject;
}


//- helpers -------------------------------------------------------------------
namespace {

   class GILControl {
   public:
      GILControl( PyROOT::TCallContext* ctxt ) : fRelease( ReleasesGIL( ctxt ) ) {
#ifdef WITH_THREAD
         if ( fRelease ) fSave = PyEval_SaveThread();
#endif
      }
      ~GILControl() {
#ifdef WITH_THREAD
         if ( fRelease ) PyEval_RestoreThread( fSave );
#endif
      }
   private:
      Bool_t fRelease;
      PyThreadState* fSave;
   };

} // unnamed namespace

static inline void GILCallV(
      Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, PyROOT::TCallContext* ctxt ) {
   GILControl gc( ctxt ); 
   Cppyy::CallV( method, self, &ctxt->fArgs );
}

static inline Long_t GILCallL(
      Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, PyROOT::TCallContext* ctxt ) {
   GILControl gc( ctxt );
   return Cppyy::CallL( method, self, &ctxt->fArgs );<commit_msg>make compiler warning go away<commit_after>// @(#)root/pyroot:$Id$
// Author: <NAME>, Jan 2005

// Bindings
#include "PyROOT.h"
#include "PyStrings.h"
#include "Executors.h"
#include "ObjectProxy.h"
#include "TPyBufferFactory.h"
#include "RootWrapper.h"
#include "Utility.h"

// ROOT
#include "TClassEdit.h"           // for ShortType and CleanType
#include "TInterpreter.h"         // for by-value returns
#include "TInterpreterValue.h"    // id.

// Standard
#include <cstring>
#include <utility>
#include <sstream>


//- data ______________________________________________________________________
namespace PyROOT {

   typedef TExecutor* (*ExecutorFactory_t) ();
   typedef std::map< std::string, ExecutorFactory_t > ExecFactories_t;
   ExecFactories_t gExecFactories;

   R__EXTERN PyObject* gNullPtrObject;
}


//- helpers -------------------------------------------------------------------
namespace {

   class GILControl {
   public:
      GILControl( PyROOT::TCallContext* ctxt ) :
         fRelease( ReleasesGIL( ctxt ) ), fSave( nullptr ) {
#ifdef WITH_THREAD
         if ( fRelease ) fSave = PyEval_SaveThread();
#endif
      }
      ~GILControl() {
#ifdef WITH_THREAD
         if ( fRelease ) PyEval_RestoreThread( fSave );
#endif
      }
   private:
      Bool_t fRelease;
      PyThreadState* fSave;
   };

} // unnamed namespace

static inline void GILCallV(
      Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, PyROOT::TCallContext* ctxt ) {
   GILControl gc( ctxt ); 
   Cppyy::CallV( method, self, &ctxt->fArgs );
}

static inline Long_t GILCallL(
      Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, PyROOT::TCallContext* ctxt ) {
   GILControl gc( ctxt );
   return Cppyy::CallL( method, self, &ctxt->fArgs );
{'fraction_non_alphanumeric': 0.15752828546562228, 'fraction_numerical': 0.0023208587177255585, 'mean_word_length': 3.0998810939357906, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4532876', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1129, 'n_words': 260}