Logo ROOT  
Reference Guide
PyStrings.cxx
Go to the documentation of this file.
1// Bindings
2#include "CPyCppyy.h"
3#include "PyStrings.h"
4
5
6//- data _____________________________________________________________________
30
32
37
40
49
52
54
57
60
61
62//-----------------------------------------------------------------------------
63#define CPPYY_INITIALIZE_STRING(var, str) \
64 if (!(PyStrings::var = CPyCppyy_PyText_InternFromString((char*)#str))) \
65 return false
66
68// Build cache of commonly used python strings (the cache is python intern, so
69// all strings are shared python-wide, not just in cppyy).
73 CPPYY_INITIALIZE_STRING(gCppName, __cpp_name__);
79 return false;
83 CPPYY_INITIALIZE_STRING(gGetNoCheck, _getitem__unchecked);
94
96
101
102 CPPYY_INITIALIZE_STRING(gLShift, __lshift__);
103 CPPYY_INITIALIZE_STRING(gLShiftC, __lshiftc__);
104
113
116
118
119 CPPYY_INITIALIZE_STRING(gNoImplicit, __cppyy_no_implicit);
120 CPPYY_INITIALIZE_STRING(gDispInit, _init_dispatchptr);
121
122 CPPYY_INITIALIZE_STRING(gExPythonize, __cppyy_explicit_pythonize__);
123 CPPYY_INITIALIZE_STRING(gPythonize, __cppyy_pythonize__);
124
125 return true;
126}
127
128
129//-----------------------------------------------------------------------------
131// Remove all cached python strings.
132 Py_DECREF(PyStrings::gBases); PyStrings::gBases = nullptr;
133 Py_DECREF(PyStrings::gBase); PyStrings::gBase = nullptr;
134 Py_DECREF(PyStrings::gCppName); PyStrings::gCppName = nullptr;
135 Py_DECREF(PyStrings::gDeref); PyStrings::gDeref = nullptr;
136 Py_DECREF(PyStrings::gPreInc); PyStrings::gPreInc = nullptr;
137 Py_DECREF(PyStrings::gPostInc); PyStrings::gPostInc = nullptr;
138 Py_DECREF(PyStrings::gDict); PyStrings::gDict = nullptr;
140 Py_DECREF(PyStrings::gEq); PyStrings::gEq = nullptr;
141 Py_DECREF(PyStrings::gFollow); PyStrings::gFollow = nullptr;
142 Py_DECREF(PyStrings::gGetItem); PyStrings::gGetItem = nullptr;
144 Py_DECREF(PyStrings::gInit); PyStrings::gInit = nullptr;
145 Py_DECREF(PyStrings::gIter); PyStrings::gIter = nullptr;
146 Py_DECREF(PyStrings::gLen); PyStrings::gLen = nullptr;
147 Py_DECREF(PyStrings::gLifeLine); PyStrings::gLifeLine = nullptr;
148 Py_DECREF(PyStrings::gModule); PyStrings::gModule = nullptr;
149 Py_DECREF(PyStrings::gMRO); PyStrings::gMRO = nullptr;
150 Py_DECREF(PyStrings::gName); PyStrings::gName = nullptr;
151 Py_DECREF(PyStrings::gNe); PyStrings::gNe = nullptr;
152 Py_DECREF(PyStrings::gTypeCode); PyStrings::gTypeCode = nullptr;
154
156
157 Py_DECREF(PyStrings::gAdd); PyStrings::gAdd = nullptr;
158 Py_DECREF(PyStrings::gSub); PyStrings::gSub = nullptr;
159 Py_DECREF(PyStrings::gMul); PyStrings::gMul = nullptr;
160 Py_DECREF(PyStrings::gDiv); PyStrings::gDiv = nullptr;
161
162 Py_DECREF(PyStrings::gLShift); PyStrings::gLShift = nullptr;
163 Py_DECREF(PyStrings::gLShiftC); PyStrings::gLShiftC = nullptr;
164
165 Py_DECREF(PyStrings::gAt); PyStrings::gAt = nullptr;
166 Py_DECREF(PyStrings::gBegin); PyStrings::gBegin = nullptr;
167 Py_DECREF(PyStrings::gEnd); PyStrings::gEnd = nullptr;
168 Py_DECREF(PyStrings::gFirst); PyStrings::gFirst = nullptr;
169 Py_DECREF(PyStrings::gSecond); PyStrings::gSecond = nullptr;
170 Py_DECREF(PyStrings::gSize); PyStrings::gSize = nullptr;
171 Py_DECREF(PyStrings::gTemplate); PyStrings::gTemplate = nullptr;
172 Py_DECREF(PyStrings::gVectorAt); PyStrings::gVectorAt = nullptr;
173
174 Py_DECREF(PyStrings::gCppReal); PyStrings::gCppReal = nullptr;
175 Py_DECREF(PyStrings::gCppImag); PyStrings::gCppImag = nullptr;
176
178
180 Py_DECREF(PyStrings::gDispInit); PyStrings::gDispInit = nullptr;
181
183 Py_DECREF(PyStrings::gPythonize); PyStrings::gPythonize = nullptr;
184
186}
#define CPPYY__div__
Definition: CPyCppyy.h:132
#define Py_RETURN_NONE
Definition: CPyCppyy.h:289
#define CPyCppyy_PyText_FromString
Definition: CPyCppyy.h:102
_object PyObject
Definition: PyMethodBase.h:42
#define CPPYY_INITIALIZE_STRING(var, str)
Definition: PyStrings.cxx:63
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
PyObject * gDict
Definition: PyStrings.cxx:14
PyObject * gCTypesType
Definition: PyStrings.cxx:29
PyObject * gDeref
Definition: PyStrings.cxx:11
PyObject * gAssign
Definition: PyStrings.cxx:7
R__EXTERN PyObject * gName
Definition: TPython.cxx:105
PyObject * gExPythonize
Definition: PyStrings.cxx:58
PyObject * gLifeLine
Definition: PyStrings.cxx:23
PyObject * gGetItem
Definition: PyStrings.cxx:18
PyObject * gThisModule
Definition: PyStrings.cxx:53
R__EXTERN PyObject * gCppName
Definition: TPython.cxx:103
PyObject * gInit
Definition: PyStrings.cxx:20
PyObject * gCppReal
Definition: PyStrings.cxx:50
PyObject * gBegin
Definition: PyStrings.cxx:42
PyObject * gFollow
Definition: PyStrings.cxx:17
PyObject * gIter
Definition: PyStrings.cxx:21
PyObject * gVectorAt
Definition: PyStrings.cxx:48
PyObject * gLShiftC
Definition: PyStrings.cxx:39
PyObject * gPreInc
Definition: PyStrings.cxx:12
PyObject * gPythonize
Definition: PyStrings.cxx:59
PyObject * gTypeCode
Definition: PyStrings.cxx:28
PyObject * gSecond
Definition: PyStrings.cxx:45
PyObject * gPostInc
Definition: PyStrings.cxx:13
PyObject * gCppImag
Definition: PyStrings.cxx:51
PyObject * gNoImplicit
Definition: PyStrings.cxx:55
R__EXTERN PyObject * gBases
PyObject * gBase
Definition: PyStrings.cxx:9
PyObject * gTemplate
Definition: PyStrings.cxx:47
PyObject * gLShift
Definition: PyStrings.cxx:38
PyObject * gDispInit
Definition: PyStrings.cxx:56
PyObject * gSize
Definition: PyStrings.cxx:46
R__EXTERN PyObject * gModule
Definition: TPython.cxx:104
PyObject * gEmptyString
Definition: PyStrings.cxx:15
PyObject * gUnderlying
Definition: PyStrings.cxx:31
PyObject * gGetNoCheck
Definition: PyStrings.cxx:19
PyObject * gFirst
Definition: PyStrings.cxx:44
PyObject * DestroyPyStrings()
Definition: PyStrings.cxx:130
bool CreatePyStrings()
Definition: PyStrings.cxx:67
R__EXTERN PyObject * gThisModule
Definition: TPython.cxx:100
static constexpr double second
Definition: first.py:1