// @(#)root/pyroot:$Id$
// Author: Scott Snyder, Apr 2004

// Bindings
#include "PyROOT.h"
#include "TPyException.h"


//______________________________________________________________________________
//                 C++ exception for throwing python exceptions
//                 ============================================
// Purpose: A C++ exception class for throwing python exceptions
//          through C++ code.
// Created: Apr, 2004, sss, from the version in D0's python_util.
//
// Note: Don't be tempted to declare the virtual functions defined here
//       as inline.
//       If you do, you may not be able to properly throw these
//       exceptions across shared libraries.


//- data ---------------------------------------------------------------------
ClassImp(PyROOT::TPyException)
void* PyROOT::TPyExceptionMagic = (PyObject*)1;
namespace {

   class TManageMagic {  // ensures that no valid PyObject can occupy the magic
   public:
      TManageMagic() { PyROOT::TPyExceptionMagic = new int(1); }
      ~TManageMagic() { delete (int*)PyROOT::TPyExceptionMagic; }
   } manageMagic;

} // unnamed namespace


//- constructors/destructor --------------------------------------------------
PyROOT::TPyException::TPyException()
{
// default constructor
}

PyROOT::TPyException::~TPyException() throw()
{
// destructor
}


//- public members -----------------------------------------------------------
const char* PyROOT::TPyException::what() const throw()
{
// Return reason for throwing this exception: a python exception was raised.
   return "python exception";
}
 TPyException.cxx:1
 TPyException.cxx:2
 TPyException.cxx:3
 TPyException.cxx:4
 TPyException.cxx:5
 TPyException.cxx:6
 TPyException.cxx:7
 TPyException.cxx:8
 TPyException.cxx:9
 TPyException.cxx:10
 TPyException.cxx:11
 TPyException.cxx:12
 TPyException.cxx:13
 TPyException.cxx:14
 TPyException.cxx:15
 TPyException.cxx:16
 TPyException.cxx:17
 TPyException.cxx:18
 TPyException.cxx:19
 TPyException.cxx:20
 TPyException.cxx:21
 TPyException.cxx:22
 TPyException.cxx:23
 TPyException.cxx:24
 TPyException.cxx:25
 TPyException.cxx:26
 TPyException.cxx:27
 TPyException.cxx:28
 TPyException.cxx:29
 TPyException.cxx:30
 TPyException.cxx:31
 TPyException.cxx:32
 TPyException.cxx:33
 TPyException.cxx:34
 TPyException.cxx:35
 TPyException.cxx:36
 TPyException.cxx:37
 TPyException.cxx:38
 TPyException.cxx:39
 TPyException.cxx:40
 TPyException.cxx:41
 TPyException.cxx:42
 TPyException.cxx:43
 TPyException.cxx:44
 TPyException.cxx:45
 TPyException.cxx:46
 TPyException.cxx:47
 TPyException.cxx:48
 TPyException.cxx:49
 TPyException.cxx:50
 TPyException.cxx:51
 TPyException.cxx:52
 TPyException.cxx:53