Logo ROOT  
Reference Guide
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 
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 
static ECallFlags sMemoryPolicy
Definition: CallContext.h:70
void AddTemporary(PyObject *pyobj)
Definition: CallContext.cxx:16
static bool SetGlobalSignalPolicy(bool setProtected)
Definition: CallContext.cxx:53
_object PyObject
Definition: PyMethodBase.h:41
static ECallFlags sSignalPolicy
Definition: CallContext.h:77
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
static bool SetMemoryPolicy(ECallFlags e)
Definition: CallContext.cxx:41