ATLAS Offline Software
Loading...
Searching...
No Matches
Control
StoreGateBindings
src
AthenaPyRoot.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
3
/*
4
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
#ifndef STOREGATEBINDINGS_ATHENAPYROOT_H
8
#define STOREGATEBINDINGS_ATHENAPYROOT_H 1
9
10
#include "Python.h"
11
#include "
RootUtils/PyGetString.h
"
12
13
// PyROOT includes
14
#include <TPython.h>
15
#include "CPyCppyy/PyException.h"
16
#ifndef ROOT_TPyException
17
# define ROOT_TPyException 1
/* there was a typo in TPyException-v20882 */
18
#endif
19
20
#define CPPInstance_ASVOIDPTR(o) (TPython::CPPInstance_AsVoidPtr(o))
21
22
namespace
PyROOT
{
23
24
inline
25
void
throw_py_exception
(
bool
display =
true
)
26
{
27
if
(display) {
28
// fetch error
29
PyObject
* pytype = 0, *pyvalue = 0, *pytrace = 0;
30
PyErr_Fetch (&pytype, &pyvalue, &pytrace);
31
Py_XINCREF (pytype);
32
Py_XINCREF (pyvalue);
33
Py_XINCREF (pytrace);
34
// restore...
35
PyErr_Restore (pytype, pyvalue, pytrace);
36
// and print
37
PyErr_Print();
38
}
39
throw
CPyCppyy::PyException();
40
}
41
42
}
//> namespace PyROOT
43
44
#endif
//> STOREGATEBINDINGS_ATHENAPYROOT_H
PyObject
_object PyObject
Definition
IPyComponent.h:27
PyGetString.h
Convert python string -> C++ string for py2 and py3.
PyROOT
Definition
PyROOTTTreePatch.cxx:31
PyROOT::throw_py_exception
void throw_py_exception(bool display=true)
Definition
AthenaPyRoot.h:25
Generated on
for ATLAS Offline Software by
1.14.0