Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
PyStrings.cxx
Go to the documentation of this file.
1// Bindings
2#include "cpyrt.h"
3
4using namespace cppjit;
5#include "PyStrings.h"
6
7//- data _____________________________________________________________________
8#define CPYRT_DEFINE_PYSTRING(var, str) \
9 PyObject* cpyrt::PyStrings::var = nullptr;
11#undef CPYRT_DEFINE_PYSTRING
12
13//-----------------------------------------------------------------------------
15 // Build cache of commonly used python strings (the cache is python intern, so
16 // all strings are shared python-wide, not just in cppjit).
17#define CPYRT_CREATE_PYSTRING(var, str) \
18 if (!(PyStrings::var = PyUnicode_InternFromString(str))) \
19 return false;
21#undef CPYRT_CREATE_PYSTRING
22
23 return true;
24}
25
26//-----------------------------------------------------------------------------
28 // Remove all cached python strings.
29#define CPYRT_DESTROY_PYSTRING(var, str) Py_CLEAR(PyStrings::var);
31#undef CPYRT_DESTROY_PYSTRING
32
34}
_object PyObject
#define CPYRT_DESTROY_PYSTRING(var, str)
#define CPYRT_CREATE_PYSTRING(var, str)
#define CPYRT_DEFINE_PYSTRING(var, str)
Definition PyStrings.cxx:8
#define CPYRT_PYSTRINGS(X)
Definition PyStrings.h:10
#define Py_RETURN_NONE
Definition cpyrt.h:69
bool CreatePyStrings()
Definition PyStrings.cxx:14
PyObject * DestroyPyStrings()
Definition PyStrings.cxx:27
Definition API.cxx:34