55TPyObjPtr runString(
const char *code,
int start)
57 LockGIL LASS_UNUSED(lock);
76 PyObject*
const object = PyDict_GetItem(dict.get(), key.get());
86 LockGIL LASS_UNUSED(lock);
96void execute(
const std::string& code)
98 execute(code.c_str());
105void execute(
const char* code)
107 impl::runString(code, Py_file_input);
114TPyObjPtr evaluate(
const std::string& code)
116 return evaluate(code.c_str());
125 return impl::runString(code, Py_eval_input);
133void putenv(
const std::string& key,
const std::string& value)
135 putenv(key.c_str(), value.c_str());
143void putenv(
const char* key,
const char* value)
149 PyObject*
const os_environ =
PY_ENFORCE_POINTER(PyDict_GetItemString(dict,
"environ"));
150 PY_ENFORCE_ZERO(PyMapping_SetItemString(os_environ,
const_cast<char*
>(key), item.get()));
acquire the GIL for the current scope.
#define PY_ENFORCE_ZERO(expression)
Enforce that an expression evaluates to zero.
#define PY_ENFORCE_POINTER(pointer)
Enforce that a Python pointer is not null.
PyObjectPtr< PyObject >::Type TPyObjPtr
PyObjectPtr to a PyObject.
TPyObjPtr getPyObjectByName(const std::string &iName)
retrieve pointer to PyObject by its name in the script.
void putenv(const std::string &key, const std::string &value)
os.environ[key] = value
lass::util::SharedPtr< T, PyObjectStorage, PyObjectCounter > fromNakedToSharedPtrCast(PyObject *object)
fromNakedToSharedPtrCast.
Comprehensive C++ to Python binding library.
Library for Assembled Shared Sources.