ROOT
v6-30
Reference Guide
Loading...
Searching...
No Matches
CallContext.cxx
Go to the documentation of this file.
1
// Bindings
2
#include "
CPyCppyy.h
"
3
#include "
CallContext.h
"
4
5
6
//- data _____________________________________________________________________
7
namespace
CPyCppyy
{
8
9
CallContext::ECallFlags
CallContext::sMemoryPolicy
=
CallContext::kUseStrict
;
10
// this is just a data holder for linking; actual value is set in CPyCppyyModule.cxx
11
CallContext::ECallFlags
CallContext::sSignalPolicy
=
CallContext::kNone
;
12
13
}
// namespace CPyCppyy
14
15
//-----------------------------------------------------------------------------
16
void
CPyCppyy::CallContext::AddTemporary
(
PyObject
* pyobj) {
17
if
(pyobj) {
18
if
(!
fTemps
)
19
fTemps
=
new
Temporary
{pyobj,
nullptr
};
20
else
{
21
Temporary
* tmp =
fTemps
;
22
while
(tmp->
fNext
) tmp = tmp->
fNext
;
23
tmp->
fNext
=
new
Temporary
{pyobj,
nullptr
};
24
}
25
}
26
}
27
28
//-----------------------------------------------------------------------------
29
void
CPyCppyy::CallContext::Cleanup
() {
30
Temporary
* tmp = fTemps;
31
while
(tmp) {
32
Py_DECREF(tmp->
fPyObject
);
33
Temporary
* tmp2 = tmp->
fNext
;
34
delete
tmp;
35
tmp = tmp2;
36
}
37
fTemps =
nullptr
;
38
}
39
40
//-----------------------------------------------------------------------------
41
bool
CPyCppyy::CallContext::SetMemoryPolicy
(
ECallFlags
e
)
42
{
43
// Set the global memory policy, which affects object ownership when objects
44
// are passed as function arguments.
45
if
(kUseHeuristics ==
e
||
e
== kUseStrict) {
46
sMemoryPolicy =
e
;
47
return
true
;
48
}
49
return
false
;
50
}
51
52
//-----------------------------------------------------------------------------
53
bool
CPyCppyy::CallContext::SetGlobalSignalPolicy
(
bool
setProtected)
54
{
55
// Set the global signal policy, which determines whether a jmp address
56
// should be saved to return to after a C++ segfault.
57
bool
old = sSignalPolicy == kProtected;
58
sSignalPolicy = setProtected ? kProtected :
kNone
;
59
return
old;
60
}
61
CPyCppyy.h
CallContext.h
PyObject
_object PyObject
Definition
PyMethodBase.h:43
e
#define e(i)
Definition
RSha256.hxx:103
CPyCppyy
Set of helper functions that are invoked from the pythonizors, on the Python side.
Definition
TPyClassGenerator.cxx:31
CPyCppyy::kNone
@ kNone
Definition
CPPDataMember.cxx:20
CPyCppyy::CallContext::Temporary
Definition
CallContext.h:107
CPyCppyy::CallContext::Temporary::fPyObject
PyObject * fPyObject
Definition
CallContext.h:107
CPyCppyy::CallContext::Temporary::fNext
Temporary * fNext
Definition
CallContext.h:107
CPyCppyy::CallContext::sMemoryPolicy
static ECallFlags sMemoryPolicy
Definition
CallContext.h:71
CPyCppyy::CallContext::SetGlobalSignalPolicy
static bool SetGlobalSignalPolicy(bool setProtected)
Definition
CallContext.cxx:53
CPyCppyy::CallContext::ECallFlags
ECallFlags
Definition
CallContext.h:52
CPyCppyy::CallContext::kUseStrict
@ kUseStrict
Definition
CallContext.h:61
CPyCppyy::CallContext::kNone
@ kNone
Definition
CallContext.h:53
CPyCppyy::CallContext::SetMemoryPolicy
static bool SetMemoryPolicy(ECallFlags e)
Definition
CallContext.cxx:41
CPyCppyy::CallContext::sSignalPolicy
static ECallFlags sSignalPolicy
Definition
CallContext.h:78
CPyCppyy::CallContext::fTemps
Temporary * fTemps
Definition
CallContext.h:108
CPyCppyy::CallContext::AddTemporary
void AddTemporary(PyObject *pyobj)
Definition
CallContext.cxx:16
CPyCppyy::CallContext::Cleanup
void Cleanup()
Definition
CallContext.cxx:29
bindings
pyroot
cppyy
CPyCppyy
src
CallContext.cxx
ROOT v6-30 - Reference Guide Generated on Sun Dec 1 2024 05:17:12 (GVA Time) using Doxygen 1.9.8