Logo ROOT  
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 _____________________________________________________________________
7namespace CPyCppyy {
8
10// this is just a data holder for linking; actual value is set in CPyCppyyModule.cxx
12
13} // namespace CPyCppyy
14
15//-----------------------------------------------------------------------------
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//-----------------------------------------------------------------------------
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//-----------------------------------------------------------------------------
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//-----------------------------------------------------------------------------
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
_object PyObject
#define e(i)
Definition RSha256.hxx:103
Set of helper functions that are invoked from the pythonizors, on the Python side.
static ECallFlags sMemoryPolicy
Definition CallContext.h:70
static bool SetGlobalSignalPolicy(bool setProtected)
static bool SetMemoryPolicy(ECallFlags e)
static ECallFlags sSignalPolicy
Definition CallContext.h:77
void AddTemporary(PyObject *pyobj)